Quick Spark Tip:  One factor you might consider towards reaching GDPR compliance is anonymizing your Google Analytics, so your visitor’s IP address is obfuscated.  The change is easy – simply add a value of “anonymize_ip” and “true” to your tracking code.  The example below shows the latest global site tag “gtag.js” version of Google Analytics code, with the additional anonymize instruction highlighted in yellow:

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXX-X"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'UA-XXXXXXX-X', { 'anonymize_ip': true });
</script>

If you are using the older “analytics.js” version of Google Analytics code, you add a line to your code as shown and highlighted in yellow:

<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('set', 'anonymizeIp', true);
  ga('create', 'UA-XXXXXXX-X', 'auto');
  ga('send', 'pageview');

</script>

Replace “UA-XXXXXXX-X” with your actual tracking ID number.

Reference:

One thought on “Spark Tip – How To Anonymize Your Google Analytics Tracking Code

  1. emoji says:

    Attractive section of content. I just stumbled upon your blog and in accession capital to assert that I get in fact enjoyed account your blog posts.
    Any way I’ll be subscribing to your augment and even I achievement you access consistently fast.

    1. Shea Park says:

      Thank you for taking the time to comment and share your thoughts.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.