• Hi there,

    any plans to insert a setting for the opt out code (before Google Analytics tracking code). It really helps for GDPR.

    I inserted the code into the “before field” – but that is not working. Any tips or workarounds?

    Thanks,
    David

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi,

    i think you need to add this in the “after” field:

    // Disable tracking if the opt-out cookie exists.
    var disableStr = 'ga-disable-' + gaProperty;
    if (document.cookie.indexOf(disableStr + '=true') > -1) {
      window[disableStr] = true;
    }
     
    // Opt-out function
    function gaOptout() {
      document.cookie = disableStr + '=true; expires=Thu, 31 Dec 2099 23:59:59 UTC; path=/';
      window[disableStr] = true;
    }

    sorry this does not work. just use a plugin to do this, i used this one:

    Google Analytics Opt-Out

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Opt-Out-Code?’ is closed to new replies.