Categories
SEO

How to Anonymize IP Addresses With GTM (and Then Verifying the Same)

How to anonymize Ip addresses with GTM? The solution here is relatively simpler than it sounds. However, before we discuss the how, let’s briefly touch on why IP address anonymization might be needed for your site, and if you do it, what are the data points you lose out on.

IP masking or IP anonymization technically is not a new feature, but I suppose people didn’t really pay attention to it until GDPR came into the picture. Google first introduced this feature on May 25th, 2010, to better enable site owners to meet specific privacy, security, and international data collection policies.

If IP anonymization is enabled, it looks like the only real data, or more like, the real accurate data you lose out on is geographical data on cities. Although, if that level of granularity doesn’t matter to you much, I’d say you should go ahead and anonymize IP addresses to get one step closer to being GDPR compliant.

How to Anonymize Ip Addresses With GTM

Note: The content that follows assumes that you’re firing your Google Analytics Tag via GTM, and everything is working correctly.

Depending on how you’ve set up your Google Analytics tracking via GTM (that is, through variables or directly through tag), an item you’d need to execute on is adding a field name and its value.

Literally, all you have to do is add the value of “anonymizeIp” (without the quotes, and yes, capital I) under field name. For the value, you’d input “true.” The option to add extra fields will typically be available under more settings when you navigate to the tag or the variable configuration. See the screenshot below for reference.

anonymizing ip address in gtm
This is as simple as it sounds.

Once done, save, publish, and you’re on your way. Next, comes the verification part where you make sure that, indeed, IP addresses are being anonymized.

How to Verify if You’ve Properly Anonymized IP Addresses via GTM

  1. To test, go to any of your pages.
  2. Then using the Chrome browser, open the inspect element feature.
  3. Next, head over to the sources tab (screenshot to follow), and hit the “reload” button.
viewing the sources data in chrome browser
  1. Upon hitting the reload button, you’ll start seeing all the data being populated under the “URL” column. From here, you’d have to select your GTM script. If it helps, filter the list by JavaScript. (See the image below for reference).
looking at scripts under the coverage tab in chrome inspect element feature
If it helps you narrow things down, filter the list by just “JavaScript.”
  1. The last step here is to select your GTM script, hit CTRL+F (to find), and type in “anonymizeIp.” If your setup has been on point, you’ll notice a line that starts with –> “vtp_fieldsToSet”:. I am providing the snapshot for reference right underneath this step.
confirming ip anonymization via chrome inspect element

Mainly, the items you’re looking for here are the details for “fieldName” and “value,” the 2 things we initially set up in GTM. Honestly, it’s that straightforward to anonymize an IP address, and verifying it.

And notwithstanding everything mentioned above, I’ve noticed some lingering questions around Google analytics, IP addresses, and GDPR. Let’s clear those up!

Does Google Analytics Store IP Addresses?

Technically yes, but some might say no, depending on who you ask. What’s consistent here is that GA uses the IP address information to provide you with in-depth data about geographic locations. However, the IP address itself is not reported.

Is Collecting IP Address Legal?

I am not a lawyer, so please don’t quote me on anything, and take this information with a grain of salt.
In the context of tracking, analytics, and for the internet to work, IP addresses are the fundamentals that connects everything together. The real question is how granular you can get in being able to view the exact details of the IP address. If you’re seriously concerned about this part, please consider hiring a lawyer.

Is an IP Address Covered by GDPR?

Fortunately, or unfortunately, based on your perspective, protecting IP addresses does fall under the regulations of GDPR. The reason for that being is this: Even though it may not convert directly into a 100% personally identifiable information every time, it conveys some information about the person (albeit, not everything), and hence, is subject to privacy laws. For a much reliable source of information, you can check out this website.

Is There a Way to Anonymize an IP Address Without Using GTM?

Certainly! Google has the following guides (1 & 2) for those wanting to do this without GTM. I prefer GTM, as I aim to centralize all my tracking, tags, triggers, etc. in one place.

How Does Google Anonymizes the IP Address?

According to Google, for an IPv4 address, they replace the last octet with zero. For example, if an IP address is 12.34.56.76, it would become 12.34.56.0. For an IPv6, the last “80 of the 128 bits are set to zero.”

You May Also Want to Check Out:

Conclusion

Anonymizing IP addresses from Google Analytics tracking is the safe route to take if you don’t want to get under the GDPR non-compliance radar — so to speak. Nonetheless, there are other things you can do, such as obtaining consent to tracking, having strong cookie policies, and other methods through which you are clearly and explicitly informing site users about your analytics tracking and IP address behavior. (Again, I am not a lawyer so please please please treat this information as if it’s incredulous).

If you’re ever in doubt, your best move would be to hire a lawyer who specializes his or her practice in internet and privacy laws, especially, someone with international experience.