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:
<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?
Are you sure that you have the right analytics code? Mine is different, see :
(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