Anonymize IP in Google Tag Manager

To set IP anonymization in GTM do this:

  • Open the tag that fires the GA pageview click the pencil at the top corner to edit the tag
  • Expand “More settings” (if you don’t see it check Enable overriding settings in this tag)
  • Expand “Fields to set
  • Click on Add a field and configure it like this:
    • Field name: anonymizeIp
    • Value: true
  • Save and publish the changes

Just remember that when you anonymize the IP your IP filters won’t work. So you should either change the last octet of your IP filters to 0 (which may filter more IPs that you need) or use a dynamic way of filtering your internal traffic, for example, using cookies.

 

UPDATE: the best way to apply anonymizeIp to all your GA tags is to do it from the “Google Analytics Settings” variable, that way you won’t have to override the field on each tag.

 

If you haven’t created this variable follow this steps:

To set up a new Google Analytics Settings Variable in GTM:

  1. Select New Variable‚Ķ
  2. In the Variable Configuration screen, enter your Google Analytics Tracking ID.
  3. Cookie Domain: Leave this value set to “auto“, unless you set the cookie domain differently on other tags.
  4. Click More Settings to add anonimizeIP.
  5. Expand “Fields to set
  6. Click on Add a field and configure it like this:
    • Field name: anonymizeIp
    • Value: true
  7. Click Save.

Now select this variable on all your GA tags.

Leave a Reply

Your email address will not be published. Required fields are marked *