• Resolved kellyjland

    (@kellyjland)


    I’ve been trying to figure this out for days.

    I was alerted by an advertising company that I work with that my Google Analytics code is loading twice and the issue is being caused by Autoptimize.

    The issue started, out of the blue on March 4th. Which is weird in and of itself.

    Things that I’ve done:

    1. Clearing site and server cache.
    2. Adding “googletagmanager” to the exclude scripts section on Autoptimize.

    It’s still showing up at the bottom of the view source page:

    wp-content/cache/autoptimize/js/autoptimize_e48400f2c8a7d8274ebb115f630bbfcf.js

    I’m not sure what else to try. And maybe the solution is super simple and I’m just overlooking it. Any help is appreciated.

    Thank you in advance.

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

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

    (@optimizingmatters)

    Hey Kelly ??

    Can you try excluding GoogleAnalyticsObject instead/ as well?

    frank

    Thread Starter kellyjland

    (@kellyjland)

    Unfortunately, that didn’t work either.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    ah, it’s not inline JS as is normally done but in a separate JS-file, you’ll have to add js/ganalytics.js to the JS exclusions instead.

    Thread Starter kellyjland

    (@kellyjland)

    Hi!

    Thanks.
    Before I make this change, I wanted to know if I just add js/ganalytics.js to the excluded files or all three: googletagmanager, googleanalyticsobject and js/ganalytics.js.

    Thank you again. You’ve been amazing and responded so quickly.

    -Kelly

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    just js/ganalytics.js will probably do, but keep the others just to be on the safe side ??

    Thread Starter kellyjland

    (@kellyjland)

    Hi!

    I’m feeling like a complete pain in the butt. I am so sorry. This did not resolve the issue. I even had my host clear the server cache again to be safe.

    I cannot figure out where it’s coming from – but I’ve been assured it IS Autoptimize that’s the issue.

    I just copy and pasted again what I am seeing after making the changes, clearing the site cache and clearing the server cache.

    {“name”:”Social Warfare – Pro”,”key”:”pro”,”core_required”:”3.3.0″,”product_id”:63157,”store_url”:”https:\/\/www.moneymakingmommy.com”,”version”:”3.5.1″,”filepath”:”\/home\/s1\/html\/wp-content\/plugins\/social-warfare-pro\/social-warfare-pro.php”,”license_key”:”290fd4d80bc48230454d813e08910d53″,”is_registered”:true},”pro”],”post_id”:”38751″,”floatBeforeContent”:”1″};</script> <script type=’text/javascript’ src=’https://www.moneymakingmommy.com/wp-content/cache/autoptimize/js/autoptimize_single_0d2db5cc775d256edd5148673000175d.js’></script&gt; <script type=’text/javascript’>var wpgdprcData = {“ajaxURL”:”https:\/\/www.moneymakingmommy.com\/wp-admin\/admin-ajax.php”,”ajaxSecurity”:”6aa775b055″,”consentVersion”:”1″,”consentStatus”:”0″,”isMultisite”:””,”path”:”\/”,”blogId”:””};</script> <script type=”text/javascript”>var swp_nonce = “39b6cbdb80”;
    function parentIsEvil() { var html = null; try { var doc = top.location.pathname; } catch(err){ }; if(typeof doc === “undefined”) { return true } else { return false }; }; if (parentIsEvil()) { top.location = self.location.href; };var url = “https://www.moneymakingmommy.com/cruises-inc-work-from-home-selling-cruises/&#8221;;if(url.indexOf(“stfi.re”) != -1) { var canonical = “”; var links = document.getElementsByTagName(“link”); for (var i = 0; i < links.length; i ++) { if (links[i].getAttribute(“rel”) === “canonical”) { canonical = links[i].getAttribute(“href”)}}; canonical = canonical.replace(“?sfr=1”, “”);top.location = canonical; console.log(canonical);};var swpFloatBeforeContent = true;var swpClickTracking = false; swpPinIt={“enabled”:true,”hLocation”:”center”,”vLocation”:”top”,”minWidth”:”200″,”minHeight”:”200″,”disableOnAnchors”:false};</script><script type=’text/javascript’ src=’https://stats.wp.com/e-201911.js&#8217; async=’async’ defer=’defer’></script> <script type=’text/javascript’>_stq = window._stq || [];
    _stq.push([ ‘view’, {v:’ext’,j:’1:7.1.1′,blog:’59623176′,post:’0′,tz:’-4′,srv:’www.moneymakingmommy.com’} ]);
    _stq.push([ ‘clickTrackerInit’, ‘59623176’, ‘0’ ]);</script> <div id=”cookie-notice” role=”banner” class=”cn-top wp-default” style=”color: #ffffff; background-color: #ec6485;”><div class=”cookie-notice-container”><span id=”cn-notice-text”>Cookies ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.</span>OkRead more</div></div><script type=”text/javascript” defer src=”https://www.moneymakingmommy.com/wp-content/cache/autoptimize/js/autoptimize_9cba0751471a37d3d1d6bc20a5743bfc.js”></script></body></html&gt;

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    Although excluded, AO will try to minify js/ganalytics.js as the filename does not indicate it being minified already, so the excluded file ends up as an autoptimize_single_xzy123.js file.

    you can disable that functionality with below code snippet, but in AO 25 (in beta now, can be downloaded from https://github.com/futtta/autoptimize/archive/beta.zip) that will be an option on the settings-page.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Google Analytics Loading Twice – Issue Caused by Autoptimize’ is closed to new replies.