Skip to main content
Last updated: 5 Jul 2024

Analytics on GOV.UK

GOV.UK uses Google Analytics 4 (GA4) to track user journeys through the site. The tracking data is available to anyone with Google Analytics Suite access for GOV.UK. You can request access to this by following the steps in the GDS wiki.

GOV.UK analytics code

The GOV.UK analytics codebase is a collection of JavaScript modules spread through a few different projects:

  • the core analytics code is in govuk_publishing_components
  • applications may have their own specific tracking included, for example finder-frontend includes specific tracking JavaScript for search pages

Tracking overview

The structure of the data sent to GA4 is recorded in our implementation record.

User behaviours and journeys can be tracked in a variety of ways. The default method of tracking is to record pageviews - data relating to a page the user has just requested (eg. URL, user-agent, referrer). Pageviews are typically recorded as the user visits the page.

Where a page offers the user navigation or interaction choices it is often desirable to track events, such as when an accordion section is expanded.

Developing and debugging Google Analytics tracking

Read our developer guide to GA4 developing.

Browser extensions such as Omnibug and Analytics Debugger show data being sent to Google Analytics. This is useful for testing what is being sent to GA and when. Other GA debuggers are also available.

GA4 and publishing applications

Some publishing applications use the GA4 code from govuk_publishing_components to provide GA4 tracking in their systems, however some publishing applications have their own approach.