Support » Plugin: GA Google Analytics » Using Global Site Tag results in JS error

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Jeff Starr

    (@specialk)

    Yes that sounds correct! A good way to test/verify would be to un-block tracking in your browser and try again (or just try in a different browser that where blocking is not enabled).

    Thread Starter hnuecke

    (@hnuecke)

    Jeff, thanks for the fast response!

    I did what you said and deleted all cookies (google and application).
    But that did not change anything.

    Additonal information about how I use your plugin:
    I added a little script in the header before your code:
    var gaProperty =’UA-xxxxxxxxx-1′; // xxxxxxxxx used here for demo purposes
    var disableStr = ‘ga-disable-‘ + gaProperty;
    if (document.cookie.indexOf(disableStr + ‘=true’) > -1) {
    window[disableStr] = true;
    }
    function gaOptout() {
    document.cookie = disableStr + ‘=true; expires=Thu, 31 Dec 2099 23:59:59 UTC; path=/’;
    window[disableStr] = true;
    alert(‘Tracking by Google Analytics was disabled for your browser Browser on this website.’);
    }

    The gaOptout function is called, when the user clicks the “disable tracking” link in the privacy notice (you might have heard about GDPR becoming effective May 25 😉

    Checking with the JS Console (breakpoint after reading the cookie) proves there is no “windows” property ‘ga-disable-UA-xxxxxxxxx-1’ defined in ‘windows’, which proves the cookie was reset.

    Nevertheless the same effect:
    The asyc call does not work because ‘js?id=UA-104766607-1’ in ‘https://www.googletagmanager.com/gtag/js?id=UA-104766607-1’ results in “failed to load response data”. I’m not sure if this simply means the promise as result of the ascny call returns -1 or if the statement is not accepted/executed at all. What might result in not tracking anything at all, even if the user did not opted out.

    I might have to go back to the alternative “old” tracking method; unless you have an idea and can help.

    Sorry for all those details, but I wanted to provide everything I found out so far 😉

    Regards
    Hans

    Thread Starter hnuecke

    (@hnuecke)

    Update: I think I found the culprit (at the end it was me ;-):

    I am using Privacy Badger, and that one blocked all access. Sorry for wasting your time with something that I should have considered and remembered earlier!!

    • This reply was modified 2 years, 11 months ago by hnuecke.
    • This reply was modified 2 years, 11 months ago by hnuecke.
    Plugin Author Jeff Starr

    (@specialk)

    Glad you got it sorted, hnuecke. Thank you for posting the follow-up message 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Using Global Site Tag results in JS error’ is closed to new replies.