Deactivate tracking by Google Analytics correctly: How to set the opt-out link

Google Analytics Opt-Out
Google Analytics Opt-Out

To make your Opt-Out-Link for Google Analytics work in WordPress:

  1. Use the text mode of the WordPress Editor.
  2. Place a normal URL as a placeholder link first.
  3. Replace URL in the generated HTML link with JS call.
  4. Make sure that the actual opt-out script is in the source test before the JS call.

Websites that use Google Analytics must give their visitors the opportunity to opt out by mid-2019. This means that there must be a link that, if clicked, deactivates Google Analytics Tracking for exactly this user and browser. From a technical point of view, a cookie is usually set in which the user’s wish not to be tracked is documented and then taken into account by the tracking script.

In order for the whole thing to work, the actual opt-out script must be loaded in the header or in any case before the opt-out link mentioned below. Google itself pretends how the opt-out script should look like.

Test if the opt-out link works

However, website operators are well advised to check immediately after implementation and also at regular intervals whether the opt-out link for Google Analytics still works at all on their own website. Unfortunately, the WordPress editor has the peculiarity that when saving links that do not contain normal URLs, but Javascript calls, for example, are disabled.

Hint and cookie have to be triggered

And so, of all things, the dutiful regular maintenance and amendment of one’s own data protection declaration can lead to the Analytics Opt Out no longer working. When clicking, a message must appear confirming that tracking has been deactivated. In addition, a cookie must be set to prevent tracking by Google Analytics. This can be checked with the browser’s developer tools. Experience shows: This is not the case with many WordPress websites. They do have an opt-out link, but it does not work.

Video: How to set the opt-out link for Google Analytics in WordPress correctly

Due to current events, we have recorded in a two-minute video how it can be ensured that the Google Analytics opt-out in the privacy statement still works even after a change / renewed saving.

Bernhard has been working as a tech editor for 10 years, then became a communications specialist. In 2011, he founded his own agency Lots of Ways. He is blogging and working with WordPress since 2006.


0 0

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Lost Password

Please enter your username or email address. You will receive a link to create a new password via email.