Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass cohort name to universal analytics set dimension #251

Merged
merged 2 commits into from
Feb 17, 2016

Conversation

h-lame
Copy link
Contributor

@h-lame h-lame commented Feb 16, 2016

During testing of alphagov/smart-answers#2265 we noticed that only the test name was being sent to GA for our custom dimension where we expected to see the cohort name too. After a bit of digging we found that the MultivariateTest had not been updated since we removed the classic GA tracker analytics implementation. Old dimensions allowed 4 arguments: the dimension index, a name (this was the name of the test), a value (this was the name of the cohort), and a scope for the data to be set in (this was session scope); whereas new dimensions allow only 2 arguments: the dimension index and a piece of custom data (because all other arguments were ignored this was just the name of the test).

We want to pass on the name of the cohort to the dimension so we change the call to set dimension from the MultivariateTest to combine the test name and the cohort name and send this as the 2nd argument to the call.

While we're at it we update the contact details for the person to communicate with about creating new custom dimensions as it's no longer Ashraf.

/cc @benilovj, @fofr

Google's new universal analytics setDimension call takes 2 arguments: the
dimension index and the custom data to set for this session.  Our
MultivariateTest still sends 4 arguments: the dimension index, the name of
the test, the name of the cohort, and the scope in which to set these
values.  This set of arguments was the pattern for the old "classic"
analytics component, but the new pattern discards the extra 2 arguments.
This means we don't get any details of the cohort sent to the tracker.

We don't need the 4th argument any more so we can discard that. We do want
the cohort though, so we combine it with the name of the test and send that
as the custom data for the dimension.
@h-lame
Copy link
Contributor Author

h-lame commented Feb 16, 2016

FWIW: I have tested this locally with the GA chrome debugger and it does send what I expect now. Showed it to Tim LB and he seemed happy with that as a test.

@fofr
Copy link
Contributor

fofr commented Feb 16, 2016

Looks good to me 👍

sihugh added a commit that referenced this pull request Feb 17, 2016
…nalytics-set-dimension

Pass cohort name to universal analytics set dimension
@sihugh sihugh merged commit b0e7361 into master Feb 17, 2016
@sihugh sihugh deleted the pass-cohort-name-to-universal-analytics-set-dimension branch February 17, 2016 09:34
boffbowsh pushed a commit to alphagov/frontend that referenced this pull request Jul 8, 2016
This pulls in a fix from govuk_frontend_toolkit that lives in 4.8.0 (see: alphagov/govuk_frontend_toolkit#251) but frontend currently uses 4.1.0.  We don't feel comfortable bumping the dependency so we instead inline the method to get the fix.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants