Google Analytics not working

I am trying to setup google analytics on my website However, it doesn’t work. For instance, on the tracking info it says: Status: Tracking Not Installed. I have added the code they provided to my header.php file right before my </head> tag.

the code I added is:

Read More
<script>
 (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','//www.google-analytics.com/analytics.js','ga');

 ga('create', 'UA-41420598-1', 'example.com');
  ga('send', 'pageview');

</script>

I see my website under the in-page analytics section, but get an error stating:

Your site doesn't load ga.js from Google. If you host the Google tracking code on your  
own servers, it isn't updated automatically and can miss important changes.
We didn't find a tracking snippet on your site. In-Page Analytics cannot load. Please  
make sure you have tracking installed correctly. If your snippet is included in a    
separate JavaScript file, you'll have to manually check it is being loaded correctly.

Can someone help me with this? How can I fix this issue?

Related posts

Leave a Reply

1 comment

  1. Are you sure that you have the right analytics code? Mine is different, see :

    <script type="text/javascript">
    
      var _gaq = _gaq || [];
      _gaq.push(['_setAccount', 'UA-XXXXXXX-X']);
      _gaq.push(['_trackPageview']);
    
      (function() {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
      })();
    
    </script>
    

    (This code has the ga.js as google wants to see) Make sure to check the code again.
    Login to analytics > click on Admin (on right top) > Click on Tracking info tab > Get the code at bottom