Skip to main content

https://insidegovuk.blog.gov.uk/2016/04/08/capturing-comprehensive-analytics-across-gov-uk/

Capturing comprehensive analytics across GOV.UK

Posted by: , Posted on: - Categories: How we work, Product changes, User insights

To help us analyse and measure the performance of our content we use Google Analytics, which records the pages users visit.

This year we’ve made improvements to GOV.UK that allows us to comprehensively record information about users’ interactions across the site.

Comprehensive analytics mission patch
Comprehensive analytics mission patch

Tracking attachment downloads and external links

The first part of our mission was to add tracking on interactions with attachments (like PDFs), and external links (like starting a service, for example tax your vehicle). This has provided us with information on the use of almost 200,000 attachments across the site for the first time.

We’d never had the ability to reliably do this before, due to the way that browsers often open the attachment or external link before tracking data can be sent.

However, a new browser API called ‘navigator.sendBeacon()’ allows the browser to send small packets of data, even if the current page is closed. It also allows the browser to prioritise loading content a user wants to see, so we aren’t degrading the user experience in favour of collecting data.

The JavaScript for tracking downloads and external links are provided as plugins in the ‘govuk_frontend_toolkit’ for easy re-use in other projects.

Before using ‘sendBeacon’ we were already gathering some limited data on external links through a tool we had previously built - the external link tracker. However, this did not have comprehensive coverage because a developer had to manually add each link we needed to track. We decided to decommission this external link tracker so that we’re only capturing data in one place.

What we’ve found

Over the first 6 months (11 Aug 2015 to 10 Feb 2016) we’ve seen just over 200 million clicks on external links and around 55 million clicks to downloads. About a third of all visits to GOV.UK involved a click on an external link and 7% involved a download.

Setting up event tracking functionality for GDS content designers

We receive quite a few requests each year for us to add campaign tracking to start pages so that departments can track the effectiveness of paid search adverts. Adding the campaign tracking has always been a task a developer had to complete.

As part of this mission, we added a self-service option so that GDS content designers are able to add campaign tracking directly to transaction start pages. This lets us be more responsive to requests from departments and start capturing analytics as soon as possible.

Capturing consistent metrics

The final part of our mission was to make sure we were sending Google Analytics consistent data about our pages. When we initially discussed how to approach this piece of work we thought of doing it format by format (which would be for over 100 formats).

Once we started to scope the work we realised that the migration work would mean that we would need to do the work twice, once for the formats in the current publishing structure and again after they had migrated.

Instead we decided to build an analytics component that would send relevant data captured about a page to Google Analytics. The compromise was that this would only work for formats that have been migrated, but this seems like the smartest way to work.

All of this is going to help us make decisions based on more reliable data. It'll give us more context about a user’s journey, which we will use to improve content and better meet user needs.

Rosalyn Vaughan is the GOV.UK Core Formats Delivery Manager. You should follow Rosalyn on Twitter.

Sharing and comments

Share this page

3 comments

  1. Comment by Stephen posted on

    "About a third of all visits to GOV.UK involved a click on an external link"

    Is that what you expected to find? Does that mean the information users are looking for is not on Gov.uk (should it be?) or are users being correctly signposted to external services as part of their user journey? (e.g. local authority websites, parliament.gov.uk, or other government bodies exempt from the Gov.uk proposition)

    • Replies to Stephen>

      Comment by Rosalyn Vaughan posted on

      We suspect this figure is due to the large numbers of people coming into GOV.UK to access transactions (like motoring tax, job search, passport applications, company information and student loans etc) that are hosted by the relevant department and not on GOV.UK. All these journeys are likely to involve an external link.

      The entry pages (not the surrounding information pages) for the top 10 of these transactions account for 8% of pageviews on the site but 39% of clicks on external links.

  2. Comment by Phil Wilson posted on

    This is really interesting.

    Is there a reason you didn't choose to use Google Tag Manager to do this, rather than rolling your own?