alphagov / govuk-frontend-docs

Technical documentation for GOV.UK Frontend
https://frontend.design-system.service.gov.uk/
35 stars 11 forks source link

Add Google Tag Manager code to the frontend docs #119

Open vanitabarrett opened 3 years ago

vanitabarrett commented 3 years ago

Similar to https://github.com/alphagov/govuk-design-system/issues/1616

What

Add Google Tag Manager code snippet to the frontend docs

We should be ok to merge these changes as the Google Tag Manager code relies on consent being given for analytics cookies, which a user can't do if we add this before we add the cookie banner.

Why

We need to add the Google Tag Manager code to the frontend docs so we can use analytics to track pageviews and events.

Who needs to know about this

Developers; Performance Analyst

Done when

owenatgov commented 2 months ago

We've now moved the design system website to GA4 as part of https://github.com/alphagov/govuk-design-system/issues/3822. From this, I'm not confident about this comment:

We should be ok to merge these changes as the Google Tag Manager code relies on consent being given for analytics cookies, which a user can't do if we add this before we add the cookie banner.

...because some of the GA4 cookies are now appearing on the frontend docs website. I think this is to do with how the domain for the GA4 cookies are being set aka .design-system.service.gov.uk as opposed to design-system.service.gov.uk; note the dot.

Currently this cookie isn't collecting any analytics data because we haven't got the analytics script on the frontend docs yet. This may also be fine as we don't currently have any data collection present via Google Tag Manager specific to the frontend docs. It's worth double checking that this is still the case, otherwise this will need to be done in tandem with https://github.com/alphagov/govuk-frontend-docs/issues/118