Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1098394
    Steve C
    Participant

    I am having issues with the Google Analytics plugin bundled with X. When I use Google Tag Assistant to see if the code is running correctly it displays issues with the code ‘Missing analytics.js script’.

    I have been advised that it may be best to try and hardcode the analytics into the site. Is this possible or would you be able to check what the issue is please?

    My site is http://eyetooth-art.co.uk.
    Let me know if you need anything else form me.

    Thanks,
    Steve

    #1098478
    Lely
    Moderator

    Hello Steve,

    I can see that this is your code:

    <script type="text/rocketscript">
      (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
      (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
      m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
      })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
    
      ga('create', 'UA-71663374-1', 'auto');
      ga('send', 'pageview');
    
    </script>

    Please check this thread:http://stackoverflow.com/questions/28209156/google-analytics-missing-analytics-js-script

    Hope this helps.

    #1098490
    Steve C
    Participant

    Thanks for the reply, after seeing reading the link you provided I think this may have something to do with CloudFlare. I have contacted them and will wait to see what they say.
    Do you think it would be worth adding the code into the themes core template file?

    #1098591
    Darshana
    Moderator

    Hi there,

    Sure, you can check with CloudFlare first. Also you can try purging their cache.

    Alternatively, you can setup a child theme (https://community.theme.co/kb/how-to-setup-child-themes/) and then add the anlytics code as follows into your child theme’s functions.php file.

    
    add_action('wp_head', 'add_google_analytics_code');
    function add_google_analytics_code() {
    echo "<script type='text/rocketscript'>
      (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
      (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
      m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
      })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
    
      ga('create', 'UA-71663374-1', 'auto');
      ga('send', 'pageview');
    
    </script>";
    }
    

    Let us know how it goes.
    Thanks!

  • <script> jQuery(function($){ $("#no-reply-1098394 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>