In some cases, you might need to anonymize the IP address of the hit sent to Google Analytics.
For all hits
To anonymize the IP address for all hits sent from a single tracker,
use the set
command to set the anonymizeIp
field
to true
on the tracker:
ga('set', 'anonymizeIp', true);
For a single hit
To anonymize the IP address of an individual hit, you can set the anonymizeIp
field in the fields object for that hit:
ga('send', 'pageview', {
'anonymizeIp': true
});
Learn more
To learn more about how IP anonymization works, read the IP Anonymization in Google Analytics article in the help center.