Create a Google Analytics Tracking Code
If you have a Google account you can create a TRACKING CODE for your website when you sign into Google Analytics.
This article covers:
- how to create a Google Analytics Tracking Code,
- how to anonymize data collected, and
- what to do when you add an SSL certificate to your website.
Anonymise Data to comply with GDPR
The collection and storage of website users' IP addresses could lead to a breach of GDPR which became law in the UK and EU in 2018.
Read more: ICO Guide to the General Data Protection Regulations.
Fortunately, Google support the anonymisation of collected IP addresses when you add a Google Analytics script to your website.
You will still need to ask visitors to agree to monitoring of their activity when they land on your website after adding Google Analytics.
But you will be able to reassure them (via your Privacy Policy and Cookie Bar - both highly recommended) that their use is anonymised by Google during the collection process.
Example Analytics Tracking Code
The image below shows an example of the Analytics Tracking Code with the addition of the anonymizeIP command, which when added will protect the privacy of website visitors.
More about how to anonymise IP addresses later in this article.
Example Snippet
Note
The unique Tracking Code ID has been obscured in the above image.
Sign up for Google Analytics
To register for Google Analytics, visit the following link:
If already registered, sign in using the button at the top of the Google Analytics screen.
If you are already signed into Google console then you will not be prompted to enter your username & password again.
How to Create a Tracking Code
These steps assume you are sign in when you visit the Google Analytics screen.