I am using Google Analytics on my website but get an error in Chrome that says:
GET http://www.google-analytics.com/analytics.js
(anonymous function)
(anonymous function)
My code for embedding is this:
<script>
var gaProperty = 'UA-XXXX';
var disableStr = 'ga-disable-' + gaProperty;
if (document.cookie.indexOf(disableStr + '=true') > -1) {
window[disableStr] = true;
}
function gaOptout() {
document.cookie = disableStr + '=true; expires=Thu, 31 Dec 2099 23:59:59 UTC; path=/';
window[disableStr] = true;
}
(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-XXXX', 'website.com');
ga('set', 'anonymizeIp', true);
ga('send', 'pageview');
</script>
Does anybody have an idea what's wrong?
i implemented GA code in my WordPress blog yesterday and i got the same error. I googled for a long time i wasn't be able to solve the issue.
However, I finally implemented the code just before the end of HEAD label http://screencast.com/t/Bh5L9x3Nk8 I do nothing and now (a few hours later) GA seems work fine and its real time tool is registering activity http://screencast.com/t/lI1eJzduJ7iR
Cheers, Jose
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.