GA Pro makes it easy to implement Anonymize (IP address anonymization) for either Universal Analytics or gtag.js tracking methods. This quick tutorial shows how to do it in a few simple steps. Estimated time required: 30 seconds, maybe a whole minute.

Pro Tip: In Google Analytics 4, IP anonymization is not necessary since IP addresses are not logged or stored.

Anonymization for gtag.js tracking

IP Anonymization for all events

To anonymize IP addresses for all events, follow these steps:

  1. Visit the GA Pro settings ▸ Configure tab
  2. Add the following code to the setting, “Custom Tracker Objects”:
{ 'anonymize_ip': true }

Save changes and done.

IP Anonymization for a single event

To anonymize IP addresses for a single event, follow these steps:

  1. Visit the GA Pro settings ▸ Configure tab
  2. Add the following code to the setting, “Custom GA Code”:
gtag('event', 'your_event', { 'anonymize_ip': true });

Change the your_event to your actual event. Then save changes and done.

Add more parameters

Quick example showing how to include multiple parameters. Simply replace this:

{ 'anonymize_ip': true }

..with this:

{ 
	'anonymize_ip': true,
	'allow_ad_personalization_signals': false,
	'allow_google_signals': false,
	'ad_storage': 'denied',
	client_storage: 'none',
	client_id: buildUserId()
}

..of course, you will need to use your own parameters (the above is just an example).

Anonymization for Universal Analytics

To implement IP Anonymization for Universal tracking, it works basically the same way. Simply add the following line to the GA Pro setting, “Custom GA Code”:

ga('set', 'anonymizeIp', true);

Save changes and done! Don’t forget to examine the tracking code preview to make sure everything is 100%.