Google Analytics IP anonymization is not detected

Due to data protection guidelines, you should make sure to use the IP anonymization command correctly.

If the integration on your website is being marked as wrong or crawlers cannot identify it correctly please you can check the following:

  • Are the commands in the right order?
    The commands must be listed in the right order in your source code. The data has to be anonymized first before it is sent:
    ga('set', 'anonymizeIp', true);
    ga('send', 'pageview');
  • Did you spell it right?
    The field is spelled "anonymizeIp" – lowercase "a", uppercase "I", lowercase "p"
  • Is your code valid?
    Please make sure that your code is not outdated. You can find Google's official guidelines here: https://developers.google.com/analytics/devguides/collection/analyticsjs/ip-anonymization
  • Are you using the code more than once?
    Only use the "anonymizeIp" command once in the source code of your page.


Depending on whether you use classic Google Analytics or Universal Analytics, there are two ways of embedding the anonymization code in your website's source code:

 

1. Classic Google Analytics (using ga.js JavaScript library)

 

<script type=""text/javascript"">

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXX-X']);
_gaq.push(['_gat._anonymizeIp']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

</script>

 

 

2. Universal Analytics


<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('create', 'UA-XXXXXXX-X', 'website.de');
ga('set', 'anonymizeIp', true);
ga('send', 'pageview');

</script>

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.
Powered by Zendesk