Add custom dimensions to Foundry pages
So we can filter by domain and 4x4.
Requested by @marks
Ick. Just realize the way that pageviews are being run asynchronously it'll be difficult to inject the custom dimensions. Gonna have to think about this one.
@chrismetcalf not sure I understand the issue. The custom dimensions should be able to be added like this to https://github.com/socrata/labs-common/blob/master/js/lib/ga-tracking.js#L11
var regexMatches = /#\/(.*)\/([a-z0-9]{4}-[a-z0-9]{4})/.exec(location.hash)
vargaCustomDimensions = {}
gaCustomDimensions.dimension1 = regexMatches[1] /* datasetDomain */
gaCustomDimensions.dimension2 = regexMatches[2] /* datasetFourByFour */
ga('set', gaCustomDimensions)
@marks Yeah, those need to be set before I call ga('send', 'pageview'), and that happens asynchronously and separately from where I parse out the domain and UID.
Totally doable, just need to figure out a way to do it that is clean.
Right - I could be wrong but I think the solution is to just put them right before the send like this example: https://support.google.com/analytics/answer/2709828?hl=en#collection