Google Analytics Settings IP-Address Anonymisation

Aus SDQ-Wiki

Task: Remove last segment of the IP address stored by Google Analytics to introduce a little anonymity.

Solution: One needs to add _gat._anonymizeIp(); to the page tracker code.


<script type="text/javascript">
  var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
  document.write(unescape("%3Cscript src='" + gaJsHost + "' type='text/javascript'%3E%3C/script%3E"));
  <script type="text/javascript">
    try {
      var pageTracker = _gat._getTracker("UA-123455678-1"); /* your tracking ID */
      pageTracker._gat._anonymizeIp(); /* ADD THIS LINE */
    } catch(err) {}

Drawback: The IP address will still be transfered to Google. When adding the Analytics tracking code, the webmaster cannot ensure that Google does not save the IP address of the callee. One needs to trust Google. The JavaScript code will be pulled from the Google server for all users which have JavaScript activated. Hence, the request IP address will be transfered to Google in any case of activated JavaScript.


Keywords: Google Analytics, data protection, anonymisation, IP, IP address