Google Analytics Opt Out

Why is opting out of Google Analytics so important? Because in Germany and perhaps soon in many European countries it is mandatory by law to provide the visitors of a website the possibility to opt out of google analytics.
If the website doesn´t provide this functionality, then the owner of the website will be fined . This law does not only apply to German websites. It also applies to websites who do business with German customers and perhaps soon with all European customers .

To opt out from Google Analytics there are two options:

  1. Opt Out with a Browser Add On. Yout can find the link here:
    Download-Seite für das Browser-Add-on zur Deaktivierung von Google Analytics
    The problem with this method is that it isn´t working on most mobile devices. That is why Google provided a second option:

  2. Opt Out with a Cookie. This option works on mobile devices. Here are two links form google:
    User Opt-out  |  Analytics for Web (analytics.js)  |  Google for Developers
    Introduction to ga.js (Legacy)  |  Analytics for Web (ga.js)  |  Google for Developers

Every website that do business with German customers and have google analytics have to provide both of the options . Otherwise the website owners will be fined.

The sad thing is, that it ist impossible to implement the second option with WIX. That means that every WIX website that use google analytics and do business with German customers can be fined.

So my big concern is when will WIX provide a possibility to opt out of Google Analytics ? This is very important because that will be a big legal issue for many WIX users who uses Google Analytics and do business with German (soon with European) customers.


it’s so important!!!

artur, was machen wir?


From your answer, it seems that you are looking to achieve 2 things:

  1. The ability to detect when a visitor has already opted out of Google Analytics - If he did, then disable the Google Analytics pixel from sending data for this session.
  2. Create a way for visitors to opt out of Google Analytics by clicking on a button.

You can achieve both by implementing your Google Analytics pixel via Google Tag Manager instead of adding it directly to your site.

Note : The following instructions require a basic understanding of Google Tag Manager. If you aren’t familiar with it, check out Google’s official help page here .

How to add Google Analytics via Google Tag Manager

  1. Remove the Google Analytics pixel from your site.
  2. Add the Google Analytics pixel via Google Tag Manager by following the instructions here .

How to check if a visitor has opted out of GA using GTM

Step 1 : Create a new GTM variable that will hold your GA ID
To add a new variable, open your GTM account and go to ‘Variables’.
Click the ‘New’ button, and add the following information to your variable.

The new variable should be:
Type : Constant
Value : Your Google Analytics ID.
Variable Name : GA ID

Step 2 : Create a new custom variable for the relevant 1st Party Cookie
This variable will hold the value currently set for the GA Opt-Out options. We can use this variable to know if this is set to ‘True’ or ‘False’.

Type : 1st-Party Cookie
Cookie Name : _ga_opt_out
Variable Name : “cookie ga opt out”

Step 3 : Create a new ‘Custom HTML’ tag to check if visitor already opted out
The code in this tag will run on every page, before our GA code. If cookie value is set to ‘True’, the tag will disable GA from running on this site.

Type : Custom HTML

Tag Name : “if opt out, disable GA”

Step 4 : Run the new ‘Custom HTML’ tag on every page, before the Google Analytics pixel
To do so, open ‘Advanced Settings’ > ‘Tag Sequencing’ > Enable the ‘Fire a tag before’ option and add the name of the tag we created in step 3.

That’s it! Now every time Google Analytics will run on any of your pages, it will first check that the user has not opted out of Google Analytics.

How to let visitors opt out of Google Analytics on your Wix site

Before getting started, add an ‘Opt Out of GA’ button to your site. Where to add this button is entirely up to you and should be based on the experience you want to provide.
Keep in mind : This part of the tutorial assumes you have already implemented the instructions outlined above.

Step 1 : Create a GTM trigger to catch any clicks on the button you created
To add a new trigger, open your GTM account and go to ‘Triggers’.
Click the ‘New’ button, and add the following information to your trigger.

Trigger Type : Click - All Elements
Condition : Only when ‘Click Text’ contains ‘Opt Out of GA’
Trigger Name : Disable GA

Note : Make sure that the text on this button is unique to this button and does not appear anywhere else on the site. This is to make sure that the trigger will only be activated when this button is clicked. In this example, the button text is ‘Opt Out of GA’, but you can add any text you want.

Step 2 : Create a ‘Custom HTML’ Tag and connect it to the trigger we defined in step 2

Tag Type : ‘Custom HTML’
Tag Name : ‘Disable GA’

Note : In the HTML, the {{GA ID}} part is based on the name you gave the variable that holds your Google Analytics ID. If you saved it under a different name, add that name instead.

That’s it. Now every time a visitors clicks on the button you created, the trigger should tell the tag to fire and it will disable GA from sending any further data for this specific visitor.

I hope this helps.



Your post is sooooo helpful!!! I tried it and it works perfectly!!! Thank you sooo soooo much for you great help!!!

Hey This is so Helpful, but i think i am too bad in this stuff… it doesn´t work :frowning: Maybe anyone can help me? :slight_smile: pleaaasse i have a businuess Site and the new law is quite near ^^

Sure! How can I reach out to you?

Thanks for this helpful information. I only struggle at one point: In Step 1 in How to let visitors opt out of Google Analytics on your Wix site there doesn’t exist an option with ‘Click Text’. What do I have to do? Thanks for any help.

Hi Thomas,

The reason you can’t see the ‘Click Text’ variable is that you need to enable it for your container.

To enable the ‘Click Text’ variable, do the following:

  1. In GTM dashboard, click on the ‘Variables’ tab from the menu on the left.
  2. Under ‘Built In Variables’, click on ‘Configure’.
  3. From the pop-up window that opens, add a checkmark next to each variable you would like to enable.

Once you enable a new variable, it will appear in the drop down list shown in your screenshot and you will be able to use it when defining conditions.



Hey Adam, you are really great. Thank you so much, I bow down in gratitude!

And is there a possibility to see if that works properly by clicking the button?


There are a few ways in which you can see that this is working. I’ll mention 2 ways that are simplest to use:

  1. Use the ‘Real Time’ report in Google Analytics - Visit the site yourself, click the button to disable GA and check that no further events appear in your ‘Real Time’ report.
  2. Install a Chrome browser extension that monitors the Google Analytics hits from your site - You can use Google Tag Assistant, GA debugger or any extension you feel comfortable with. Once GA is disabled, these extensions should not show any further hits being sent from the site.


Thank you very much for this useful information. I created now a GTM account and implemented all your suggestions. I have just 2 questions:

  1. What do you mean exactly with “add an ‘Opt Out of GA’ button to your site”? Just a normal wix-button and if so, which is the link for it? do we have the possibility to give an answer like: “Now you are not being tracked by Google Analytics on this site anymore” in a pop out after clicking on this button?
  2. Is it possible to re-activate the Google Analytics to analyze the visitor’s behavior and at the same time use the Google Tag Manager?

I’m clearly not savyy in this area and would really appreciate any help in this matter. Thank you!


Thanks for your advice, Adam. I don’t know why, but now Analytics doesn’t work at all. I spent several ours and went through the protocol again and again. But without success. Can you see from that picture already a problem? Regards, Thomas

Hey Adam,

First of all thanks for your help.

I’m struggling at this point. I can’t find advanced settings in Google Analytics or In Google Tag Manager. I don’t know where you changed the settings.

Hi Hendrik, can you make a screenshot how your Universal Analytics looks like?

Oh sorry, I meant the universal analytics in your google tag manager. Your previous post showed a screenshot from Adam right? Can go to your google tag manager container and make there a screenshot of your universal analytics?

I’m sorry. I am not really familiar with these environments. I think you are from Germany and me as well. I could also give you my contact details, so that I don’t put to much mess in here…

Sure! I will contact you in Facebook.

Hello everybody,

I have the same problem or question as Sofia ("What do you mean exactly with “add an ‘Opt Out of GA’ button to your site”? Just a normal wix-button and if so, which is the link for it? do we have the possibility to give an answer like: “Now you are not being tracked by Google Analytics on this site anymore” in a pop out after clicking on this button? ").

Is it a normal button that you insert in WIX? Where is this linked?

Thank you so much.



The button I mention in my original reply is regular button. You add it to the site just like any other button, the rest of the functionality will be added using GTM.

If you want to add additional behavior to the button, such as linking it to a ‘lightbox’ element that lets the user know he is not being tracked by GA anymore, you can just add that functionality using the Wix editor.

Since the rules for the trigger we define in GTM are based on the button’s text, adding additional functionality to the button should not affect the trigger.

In other words, the solution shown in my original reply on this thread should not be affected when you add additional functionality to the button.