Google Analytics Settings IP-Address Anonymisation

Aus SDQ-Wiki
Wechseln zu: Navigation, Suche

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.

Example:

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

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.

See

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