Use Google Analytics legally

For a long time, Google Analytics was a red rag for German privacy advocates. Then, surprisingly, the search engine group came to an agreement with data protection officials on the legally compliant use of Google Analytics. Nevertheless, site operators still have a lot to do in order to be able to use Google Analytics legally and without fear of warnings. We'll show you step by step how to do it.

1. Order data processing

Enter into an order data agreement with Google. Here you can view and use the model contract created by Google and data protection officers:

The signed agreement in duplicate and a self-addressed return envelope must be mailed to Google in Ireland:

Contract Administration Department
Google Ireland Ltd
Gordon House Barrow St Dublin 4

2. IP anonymization

Google Analytics may only be used if the user's IP address is shortened before it is transmitted to Google. For this purpose, Google has introduced the code "anonymizeIP". You have to include this code in your Google Analytics code.

IMPORTANT: Each webmaster must independently anchor the code for the anonymizeIP() function in his Google Analytics code.
Do you already have a website with us? Then our system will do the implementation automatically and you can skip this section.
Since the implementation of the code is described in a very vague manner in Google's instructions, we have written our own short instructions:

The standard Google Analytics code looks like this:

With the anonymizeIP() function it then looks like this:

So you have to gtag('config', 'UA-XXX-X'); With gtag('config', 'UA-XXX-X', { 'anonymize_ip': true }); substitute. For UA-XXX-X, enter your identifier.

3. Set browser plug-in and opt-out cookie

The instruction about Google Analytics must also point out to the user that he can object to the tracking. The possibility of objection must also be technically correctly implemented on your site.

  • Browser plugin for desktop
  • Opt out cookie for mobile

The link to the browser plugin is

You set the opt-out cookie as follows:

You can download the code here

4. Adjust data protection declaration

Inform yourself completely and correctly in your privacy policy about whether and how you use Google Analytics. Also present the points order data processing (ADV), IP anonymization and objection options (browser plug-in and opt-out cookie).

Practical tip:

As an eRecht24 agency partner, we can already support you in implementing a correct data protection declaration in accordance with the GDPR.