Adding the IP Anonymisation Tag to Universal Analytics Properties

Following on from the recent rulings within various EU countries about the transfer of personal data on sites using Google Analytics, there are some changes that all Google Analytics users need to be aware of. The changes are described briefly below along with instructions on how to rectify this on your website.

Does this affect all Google Analytics users?

In short, no. If you are using the new GA4 property then IP anonymisation is already taken care of. This change only impacts sites that are using the older Universal Analytics property.

How do I check which property I am using on my website?

You can do this in Google Analytics but the fastest way is to take a look at the header code on your website.

  1. Go to your website.
  2. Right click and select View Source. Now you need to search for a few different terms.
  3. First let’s eliminate Google Tag Manager. If you’ve installed your Google Analytics code using Tag Manager these instructions won’t work for you!

Search your page source for Tag Manager code

  1. Click Ctrl+F to open a Search box and type gtm then press Enter. You’ll drop down the page to the location of your any tag manager tags.

    In this search below you can see the tag is managed by a plugin. We can still check for instances of Google Analytics code but, if we don’t find anything, we can assume our GA properties are implemented via GTM.

Search your page source for GA4 Property code

  1. Click Ctrl+F to open a Search box and type gtag then press Enter. You’ll drop down the page to the location of your Google Analytics tag.

    In this search shown below you can see the gtag code is prefixed with “G-“. This means it’s a GA4 property, so no updates are needed to this site.

Search your page source for Universal Analytics Property

  1. Click Ctrl+F to open a Search box and type UA- then press Enter. You’ll drop down the page to the location of your Google Analytics tag.

    In this search shown below we found the Analytics code prefixed with “UA-“. This means it’s a Universal Analytics property and must be updated.

    Another thing to note is that the tag is installed with the older ga script denoted by “ga” rather than “gtag”. The steps to update this are slightly different – and will be posted here shortly!) The best thing to do at this point is replace the ga tag with the gtag. Then you can continue with these instructions.

Now you’ve identified whether or not you need to update you tag, you can follow the appropriate instructions below to make the changes.

How do I update Google Analytics on my WordPress website?

There are many ways to implement Google Analytics on your WordPress site. Some will give you more control than others.

If you are using the a plugin that allows you to edit the code that is inserted into the header, you can simply fix it by adding the anonymize IP parameter. The example below refers to the Header and Footer plugin. Read this post for instructions on using this to add your Google Analytics property code to your website.

  1. Copy and paste the below code block into the Header section of the Header and Footer plugin.
gtag('config', '<GA_MEASUREMENT_ID>', { 'anonymize_ip': true });
  1. Replace <GA_MEASUREMENT_ID> with your UA property tag (e.g., UA-12345678).
  2. Delete the old line of code starting with gtag etc.

If you’re unable to edit the code (perhaps because the plugin links to your GA account and doesn’t have an edit option, I recommend you remove the plugin and install it again using the method described in this post about installing Google Analytics with the Header and Footer plugin.

How do I update Google Analytics on my Wix website?

  1. Login to your Wix website Dashboard.
  2. From the menu selection Marketing & SEO and then Marketing Integrations.
  3. Select Google Analytics and then View.
  1. Click the blue button and select Edit.
  1. Here you can see whether you have the GA or the UA tag installed.
  2. Check the IP Anonymisation option (if not already selected) and then Save your changes.

That’s it!

Note: It is only possible to implement GA on a Premium subscription to Wix.

How do I update Google Analytics on my SquareSpace website?

How you update Google Analytics will depend which of the two possible ways you used to set it up in the first place.

Method 1: Using the External API

  1. First check this method.
  2. Select Settings then Advanced.

If you have GA setup this way you’ll see the tracking code here.

Unfortunately, it’s impossible to update the actual content of the code if you have setup GA up with this method as, unlike in Wix, there isn’t an option for IP Anonymisation, so you should

  1. Make a copy of the Google Analytics code (cut and paste it into a note or text file) then delete it.
  2. Follow the steps in Method 2 to setup and amend the code.

Method 2: Using Code InjectionDon’t panic – this is not as dangerous as it sounds.

  1. Select Settings and then Advanced, then Code Injection.
  2. Copy this block of code into the Header section.
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src=""></script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
  gtag('config', 'YOURPROPERTY', { 'anonymize_ip': true });
  1. Change the text that says YOURPROPERTY to the property code (starting with G- or UA-) that you copied from the previous section.
  2. Click Save.

And breathe.

Checking Google Analytics still works

After making changes like this it’s useful to be able to check that it is all working.

To do this go to SiteChecker Pro and insert the URL of your website. Just click the blue arrow button to check the result.

If you like found this post helpful and want to support me, please click the button below!

What if you need help?

If you don’t like the idea of messing with code of feel daunted by the idea of doing this yourself, you can book my time for the Google Analytics Quick Fix. In this time I can check your Google Analytics on any website, make any updates, or implement a completely new tag. Book it now!

More Like This

Do you need someone to maintain your WordPress site?

Whether you’re looking for a monthly maintenance plan or occassional updates, we can help.