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

  • Resolved hnuecke

    (@hnuecke)


    Hi Jeff,
    once I enable Global Site Tag / gtag.js I get an error in this line of the index file:
    <script async src=”https://www.googletagmanager.com/gtag/js?id=UA-104766607-1″></script>

    Error message:
    GET https://www.googletagmanager.com/gtag/js?id=UA-104766607-1 0 ()
    failed to load resource: net::ERR_BLOCKED_BY_CLIENT

    I just want to verify/check that I understand correctly and the error is simply the result of my browser settings (block tracking) and everything should be working fine and as expected.

    Please confirm or correct!

    Thanks and regards
    Hans

    • This topic was modified 1 year, 1 month ago by  hnuecke.

    The page I need help with: [log in to see the link]

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).

    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

    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 1 year, 1 month ago by  hnuecke.
    • This reply was modified 1 year, 1 month 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.