Skip to main content
Warning This document has not been updated for a while now. It may be out of date.
Last updated: 5 Feb 2021

smart-answers: Custom Google Analytics account and Tracking ID

This describes how to record data in a different Google Analytics account. This can be useful when testing Google Analytics integration to ensure that things are working as expected.

Custom Tracking ID

You'll need your own Google Analytics account and to have created a Tracking ID for Smart Answers. Creating these is outside the scope of this guide.

Running Static locally

You'll need to have a copy of Static running locally. Smart Answers expects to find your local copy of Static at http://static.dev.gov.uk. You can change this by setting the PLEK_SERVICE_STATIC_URI environment variable.

Using your custom Tracking ID

Open your copy of Static and replace the universalId variable in analytics/init.js with your Tracking ID.

Testing that it works

Open your Google Analytics account and visit the Real Time > Overview report. Visit your local copy of Smart Answers and observe the activity in Google Analytics.

Debugging

The Google Analytics Debugger Chrome extension can be useful when trying to understand why you're not seeing the data you expect in Google Analytics.