Edit page

Web analytics

We use Google Analytics on most of our sites. It’s free (within limits), it’s easy to implement and there aren’t many things it can’t track.

The login details for the shared Google Analytics account are kept in 1Password, search for “Google Analytics”.

Implementing #

We add Google Analytics via gtag.js. If you’re using whippet-theme-template, the code is already included in the footer and you just have to enter the correct tracking ID.

Event tracking #

By default, page views are the only user interaction that Google Analytics will record.

If there are specific events you want to track that Google Analytics will not track by default (e.g. clicks on links to external sites, file downloads), you will need to implement a custom event, as per Google’s instructions.

It’s important to note the section on handling timeouts. If you don’t do that, the links you are tracking won’t work if GA doesn’t load (e.g. if the user has a browser extension that blocks trackers).

Configuring #

There are a few basic steps it’s worth following for any site you’ve set up in Google Analytics:

Take some time to think about what activity on the site you might want to track. If you do not record a user action at the time it happens, it is lost forever, so the more you can set up in advance (e.g. goals for transactions such as newsletter sign-ups, recording of on-site search terms), the better.

Understanding Google Analytics #

GA uses a lot of jargon. It also has a tendency to present its data as absolute fact, even when there are all kinds of assumptions or complexities that underlie it. Some good resources for understanding it:

Useful resources #


Last updated: 9 May 2023 (history)