• Resolved George

    (@geoogz)


    Hi guys,

    Is it possible to check the “Also aggregate inline JS?” without including the google analytics code and some tracking events? Coz I’m having trouble on optimizing my page. Please see attached URL ( http://mockupr.com/mu/uzvl9825/page-optimization ).

    The real deal is Page Speed still “UNAVAILABLE”. Maybe if we exclude the analytics in the js it will lessen the file size of generated js by autoptimize or not?

    I hope someone can help me 😀

    Note:

    • I checked “Also aggregate inline JS?” because of deferring the jquery.js and other js files and also the aggregate one.
    • Revolution slider and Lazy load is active
Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    you can exclude any inline JS by adding a (unique) keyword from it to AO’s comma-separated JS optimization exclusion list @geoogz, have a look at the AO FAQ for more info on how to exclude.

    hope this helps,
    frank

    Thread Starter George

    (@geoogz)

    <!-- Global site tag (gtag.js) - Google Analytics -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=GA_TRACKING_ID"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());
    
      gtag('config', 'GA_TRACKING_ID');
    </script>

    Like this one sir frank. It is possible to exclude it in aggregating js. I want to stay the code at the top of the head, not in the generated autoptimize file.

    I excluded it but nothing change ‘seal.js,gtag.js,google-analytics.js’

    • This reply was modified 5 years, 6 months ago by George.
    Plugin Author Optimizing Matters

    (@optimizingmatters)

    try adding your GA tracking ID (or gtag), that should work 🙂

    Thread Starter George

    (@geoogz)

    Thank you so much (Y)

    How about javascript like this one sir

    <script>
            document.addEventListener("DOMContentLoaded", function(event) {
                var animate = document.getElementsByClassName("animate"),
                    len = animate !== null ? animate.length : 0,
                    i = 0;
    
                for (i; i < len; i++) {
                    animate[i].className += " active";
                }
            });
        </script>
    • This reply was modified 5 years, 6 months ago by George.
    Plugin Author Optimizing Matters

    (@optimizingmatters)

    for that I would try with animate[i].className 🙂

    Thread Starter George

    (@geoogz)

    Thanks a lot, sir!

    I’m not familiar in javascript because it’s easy to use the jquery. But with your solution I think I need to target always the “function script”, is that right sir?

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    Thanks a lot, sir!

    Please do call me Frank 🙂

    I’m not familiar in javascript because it’s easy to use the jquery. But with your solution I think I need to target always the “function script”, is that right

    to exclude inline JS from being aggregated you mean? sometimes the function name can indeed be used, unless if it’s not unique enough.

    Thread Starter George

    (@geoogz)

    Please do call me Frank 🙂

    okay Frank 😀

    Thank you again.
    Mark as fixed

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Don’t include google analytics’ is closed to new replies.