What is IP anonymization (masking)?

An overview of IP anonymization in Google Analytics

What is IP anonymization or IP masking?

Internet Protocol (IP) address anonymization or masking involves obscuring a website visitor's IP address. Anonymization is often used to enhance user privacy in data collection practices like website analytics. Google Analytics is a common use case for anonymization.

For instance, before sending to Google Analytics servers, the last octet of the IPv4 address or the last 80 bits of the IPv6 address can be deleted or masked in such a way that the IP address can no longer be attributed to a specific user.

IP anonymization

IP address anonymization occurs before any visitor's data is stored or processed. For instance, for the newest version of Google Analytics 4, 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 requires explicit addition of a parameter to your tracking code.

How to enable IP anonymization in Google Analytics

The process of IP address anonymization takes place within two steps in the collection pipeline: the JavaScript Tag and Collection network:

IP anonymization in Google Analytics

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 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>

Did you find this article helpful?

0 out of 0 Bunnies found this article helpful

Glossary

HTTP

Hypertext Transfer Protocol. A protocol that connects web browsers to web servers when they request content.

Layer 3

The layer of the OSI model that handles communication over networks.

IP Address

A unique location on the internet represented by an alphanumeric address. The two current standards are IPv4 and IPv6.

Prove your Knowledge.
Earn a bunny diploma.

Test your knowledge in our Junior and Master Quizes to see where you stand. Prove your mastery by getting A+ and recieving a diploma.

Start the QuizBunny with a diploma.