An overview of IP anonymization in Google Analytics
General overview of how we can achieve IP anonymization or IP masking in Google Analytics.
Internet Protocol (IP) address anonymization or masking is simply sending a visitor's IP address to Google Analytics servers by deleting/masking the last octet of the IPv4 address or the last 80 bits of the IPv6 address.
IP address anonymization occurs before any visitor's data is stored or processed by the Google servers. For the newest version of Google Analytics 4, the IP address anonymization is enabled by default and no manual action is required. For older versions, IP address anonymization is an opt-in feature that needs to be explicitly by adding a parameter to your tracking code.
The process of IP address anonymization takes place within two steps in the collection pipeline: the JavaScript Tag and Collection network:
IP address anonymization with analytics.js
:
ga('set', 'anonymizeIp', true);
IP address anonymization with gtag.js
:
gtag('config', '<GA_MEASUREMENT_ID>', { 'anonymize_ip': true });
IP anonymization can also be set up through Google Tag Manager (GTM) graphical settings interface.
IP anonymization for iOS is done automatically with the use of Firebase SDK
or with the following line when using iOS SDK
:
[tracker set:kGAIAnonymizeIp value:@"1"];
IP anonymization for Android is done with Google Analytics Services SDK for Android
with the following configuration parameter:
<string name="ga_anonymizeIp">true</string>
Hypertext Transfer Protocol. A protocol that connects web browsers to web servers when they request content.
The layer of the OSI model that handles communication over networks.
A unique location on the internet represented by an alphanumeric address. The two current standards are IPv4 and IPv6.