How to enable IP Anonymization in Google Analytics

Now with GDPR is better to anonymize (hide) the IP of your visitors.

Here it is one easy way in case you use the newer gtag.js from Google Analytics in your website.

Add after Google Analytics ID:
{ 'anonymize_ip': true }


So the script it will look like this:
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src=""></script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'GA_TRACKING_ID', { 'anonymize_ip': true });


  • Was this Helpful ?
  • YesNo