Enabling Google Analytics IP Anonymization feature is a best practice for websites that want to comply with GDPR. This guide includes instructions for enabling this feature with gtag.js, analytics.js, and Google Tag Manager.
Google Analytics default behavior relies on identifying individual visitors to track and analyze activities on a website. If you have concerns about using Google Analytics in relation to GDPR compliance, we recommend enabling Google’s IP Anonymization feature in the EU. This feature allows you to mask or anonymize your visitor’s IP address before sending that user data to Google Analytics.
Visit the Google Analytics IP anonymization docs for more details on this feature.
Implementing IP Anonymization in Google Analytics
IP Anonymization with gtab.js
If you are using gtab.js, follow Google’s instructions for enabling IP anonymization with gtag.js.
IP Anonymization with analytics.js
If you are using gtab.js, follow Google’s instructions for enabling IP anonymization with analytics.js.
IP Anonymization with Google Tag Manager (GTM)
Follow these instructions to enable IP anonymization for Google Analytics if you are using Google Tag Manager.
- In your Google Tag Manager account, open the Google Analytics tag for your website.
- Click the edit icon.
- In Tag Configuration, choose more settings and expand the “fields to set” option.
- Click +Add Field and set the field name as “anonymizeip”.
- Set the Value to true and click save.
- Once saved, submit and publish your new setup.
Testing IP Anonymization
- Open your website where IP-address anonymization is in place.
- Open your developer tools (Chrome | Firefox | Safari).
- Go to the “Network” tab and refresh your webpage.
- In the search box in the upper left-hand corner, search for “collect”.
- Click on the listing that includes www.google-analytics.com.
- Once opened, do a search (Mac: command + F | Windows: Ctrl + F ) for the IP anonymization parameter: aip = 1.
- If the aip = 1 parameter exists, you have correctly set up Google Analytics’s IP anonymization option.