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

Update cross domain analytics code and extend tests #1832

Merged
merged 3 commits into from
Sep 2, 2019

Conversation

andysellick
Copy link
Contributor

@andysellick andysellick commented Aug 31, 2019

Still trying to figure out how all this analytics code works by adding new tests.

  • fairly sure that calls to GA for linked domains should pass domains as an array of strings
  • addLinkedTrackerDomain was accepting domain (an array of one or more strings) and wrapping it in another array
  • working assumption is because that was assumed to be a string, when GA requires an array of strings (original authors assumed we'd only ever want one linked domain?)
  • tests extended to include tests for when more than one linked domain is needed

This PR has required an updated version of govuk_frontend_toolkit. The toolkit is deprecated, and analytics code from it was recently copied into this application, but it turns out that the code in toolkit was still executing, overriding any changes made here. The updated version of toolkit removes all of the analytics code.

Trello card: https://trello.com/c/ZRP8jWmd/75-understand-fix-ga-cross-domain-tracking-code-in-static

- fairly sure that calls to GA for linked domains should pass domains as an array of strings
- addLinkedTrackerDomain was accepting domain (an array of one or more strings) and wrapping it in another array
- working assumption is because that was assumed to be a string, when GA requires an array of strings
- tests extended to include tests for when more than one linked domain is needed
- some unexplained behaviour: passing one domain results in a call containing that string in an array, passing more than one results in the strings inside an array inside another array, this does not look right but currently unable to figure it out
- looks like tests are not calling the addLinkedTrackerDomain code in app/assets/javascripts/analytics_toolkit/, or at least log statements briefly added to that code are not triggered by the tests, also unexplained behaviour
@andysellick andysellick force-pushed the improve-cross-domain-analytics-code branch from 453efb9 to 859d998 Compare September 2, 2019 10:38
- update removes duplicate analytics code, should allow tests to pass
@andysellick andysellick merged commit e0dc110 into master Sep 2, 2019
@andysellick andysellick deleted the improve-cross-domain-analytics-code branch September 2, 2019 13:27
@andysellick andysellick mentioned this pull request Sep 2, 2019
@andysellick andysellick restored the improve-cross-domain-analytics-code branch September 2, 2019 14:11
@andysellick andysellick deleted the improve-cross-domain-analytics-code branch September 2, 2019 14:11
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.

2 participants