How to Anonymize IP Addresses in Google Analytics

Do you want to anonymize IP addresses of your site visitors in Google Analytics? It’s easy with MonsterInsights.

In this guide, we’ll show you how to enable anonymize IP in Google Analytics with MonsterInsights so that you can comply with applicable privacy laws. (Please see an important legal disclaimer at the bottom of this guide.)

Before starting, you’ll need to have MonsterInsights installed, and your Google Analytics account connected.

Please navigate to Insights » Settings » Engagement » Demographics and toggle on the Anonymize IP Addresses option.

It’s the second option:

The Anonymize IP Addresses toggle will become active.

If you are a MonsterInsights Plus user or higher, you can install and activate the EU Compliance Addon. When this addon is active, it will automatically turn the Anonymize IP Addresses option on.

The Demographics section will disappear and instead you’ll be able to find the option at Insights » Settings » Engagement » EU Compliance:

Enabling this setting will add the following code to your tracking:

// If you have a GA4 property:
__gtagTracker( 'config', 'G-xxxxxxxxxx', {"anonymize_ip":"true"} );

// If you have a UA property:
__gtagTracker( 'config', 'UA-xxxxxxxx-x', {"anonymize_ip":"true"} );

This code will anonymize the last octet of the IP address of your site visitors before storage.

If you’re going to view the source code of your site to confirm this is working, be sure to clear any site cache (if applicable) and your browser cache, and view in an incognito window before confirming.

Remember: Google Analytics doesn’t collect Personally Identifiable Information by default, and IP’s aren’t ever exposed, but this IP data is used to collect location information such as city and country information.

If you are using a GA4 property, GA4 properties are specifically built to be privacy-centric by design. This means GA4 properties anonymise IP address by default and this feature cannot be turned off.

That’s it! Now you know how to Anonymize IP Addresses in Google Analytics.

Do you need to go further?

If the EU GDPR applies to your business, please see our guide: Getting Started with the EU Compliance Addon.

 

Legal Disclaimer: This addon is designed to automate some of the settings change required to be in compliance with various EU laws however due to the dynamic nature of websites, no plugin can offer 100% legal compliance. Please consult a specialist internet law attorney to determine if you are in compliance with all applicable laws for your jurisdictions and your use cases.

As a website operator, it is solely your responsibility to ensure that you are in compliance with all applicable laws and regulations governing your use of our plugin.

MonsterInsights, its employees/contractors, and other affiliated parties are not lawyers. Any advice given in our support, documentation, website, other mediums or through our services/products should not be considered legal advice and is for informational and/or educational purposes only and are not guaranteed to be correct, complete or up-to-date, and do not constitute creating/entering an Attorney-Client relationship.