• Resolved bomarley

    (@bomarley)


    Hi, thank you for the great plug-in! Since we have enabled it our google analytics is not tracking correctly. When disabled it is. It is not counting organic visitors and I have tested this via google analytics real-time. For some reason users are counted as direct. PPC is counting correctly though. Do you have any ideas?

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    are you using a plugin to integrate GA and if so have you tried excluding that from Async/ defer?

    Thread Starter bomarley

    (@bomarley)

    Thanks for the swift response! No we are not, I have it loading via Google tag manager.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    so all is handled through inline JS? can you check the HTML source to see if somewhere in that inline GTM JS there is an async (or defer) flag added by asyncJS?

    Thread Starter bomarley

    (@bomarley)

    I sure will, let me get back to you shortly.

    Thread Starter bomarley

    (@bomarley)

    This is what is loading in live source code.

    
    <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-REMOVEDFORPRIVACY"
    height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
    Plugin Author Optimizing Matters

    (@optimizingmatters)

    but that’s the noscript part, can you also post what is inside <script> tags (make sure to mark it as code to avoid it’s removed)?

    Thread Starter bomarley

    (@bomarley)

    I think I may have found the problem, we also use WP Rocket. When disabling WP rocket the tag manager script loads correctly now with the following.

    <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
    new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
    j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
    'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
    })(window,document,'script','dataLayer','GTM-private');</script>

    With WP Rocket enabled it loads only

    <noscript><iframe src=”https://www.googletagmanager.com/ns.html?id=GTM-REMOVEDFORPRIVACY;
    height=”0″ width=”0″ style=”display:none;visibility:hidden”></iframe></noscript>

    Thread Starter bomarley

    (@bomarley)

    Ok just confirmed it with Google Analytics real time, tracking is working correctly and had nothing to do with your plug-in. Something with WP Rocket was stripping the script. I really appreciate you help and your script is just awesome!

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    you’re welcome, feel free to leave a review of the plugin and support here! 🙂

    Thread Starter bomarley

    (@bomarley)

    You bet!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Google Analytics not working correctly’ is closed to new replies.