alphagov / govuk-design-system

One place for service teams to find styles, components and patterns for designing government services.
https://www.gov.uk/design-system
MIT License
473 stars 225 forks source link

Migrate analytics to GA4 #3822

Open romaricpascal opened 1 month ago

romaricpascal commented 1 month ago

Brief

Migrate the analytics set up on the Design System site to GA4, as Universal Analytics (our current set up) is being retired on July 1st.

This'll require us to:

There are a couple of key things we'll want to make sure to keep:

Other features should first be reviewed before being re-implemented in GA4:

Finally we should also make sure our set up is well documented to make future changes easier.

In addition to migrating the Design System site, we'll want to look at collecting analytics on the Frontend Docs as well.

As a stretch goals, we could:

Epic lead

@romaricpascal

Driving role(s)

Developers

Supporting roles

Product manager, User researcher

Further detail

### Access and familiarisation
- [ ] https://github.com/alphagov/govuk-design-system/issues/3858
- [ ] https://github.com/alphagov/govuk-design-system/issues/3853
- [ ] https://github.com/alphagov/govuk-design-system/issues/3854
- [ ] https://github.com/alphagov/govuk-design-system/issues/3855
### Migrate Design System site
- [ ] https://github.com/alphagov/govuk-design-system/issues/3856
- [x] Create GA4 properties (one for production and one for review apps)
- [ ] https://github.com/alphagov/govuk-design-system/issues/3863
- [ ] https://github.com/alphagov/govuk-design-system/issues/3864
- [ ] https://github.com/alphagov/govuk-design-system/issues/3865
- [x] Review data collected by GA4 against UA data
- [ ] https://github.com/alphagov/govuk-design-system/issues/3874
- [x] --- 1st of July ---
- [ ] https://github.com/alphagov/govuk-design-system/issues/3857
- [ ] https://github.com/alphagov/govuk-design-system/issues/3870
- [ ] If necessary, set up analysis tool for exising UA data
- [ ] https://github.com/alphagov/govuk-design-system/issues/3878
- [ ] https://github.com/alphagov/govuk-design-system/issues/3879
### Process/documentation
- [x] Ensure Frontend doc repository has an 'analytics' label like our other repositories
- [ ] Update documentation for process for managing users and properties on Google Analytics and GTM
- [ ] Document variables/tags/triggers of the GA4 setup
### Stretch goals
- [ ] Review JavaScript variables in GTM for unnecessary code (eg. polyfills)
- [ ] Reinstate the tag tracking text copies (if accurate enough)
- [ ] Make a report on navigations to GitHub discussions from link at bottom of our components/patterns pages
- [ ] Investigate if we can access search terms on external search engines which led people to our site
- [ ] Fix external link event considering internal navigation as external clicks on preview sites
romaricpascal commented 2 weeks ago

Useful links from the existing set up (internal access)

GDS Data community has a migration guide.

Google has some guidance as well as some video content about GA4 which may come handy.