问题
I am facing a big issue on my website.
The problem is, because of some reason my analytics code link refuses to talk with the following link:
https://www.google-analytics.com/analytics.js
and gives me this error in the console:
GET https://www.google-analytics.com/analytics.js net::ERR_CONNECTION_REFUSED
I have contacted the Google Analytics Support but useless. They told me to copy the analytics code exactly as it's shown.
<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','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-xxxxxxx-x', 'auto');
ga('send', 'pageview');
</script>
I am using Managed Wordpress Hosting from GoDaddy. Is there anyone who faced this problem?
Thank you, Mitko
回答1:
I have just looked at your Source Code and can see that you have not placed your Google Analytics Tracking Code between your <head>
and </head>
tags. Try placing the code between these tags and see how you get on. Let me know if you are still having a problem!
回答2:
To anyone that is having this problem, i came across it resently and i found out that it was a problem with my router. I dont really know what it was, but this error only happened on my cellphone and PC when they where connected to it. So reseating the rooter did the trick.
This is probably the answer if the problem only happens in one network. If it happens in another don't even bother.
回答3:
I got this same error today, and eventually figured out it had to do with my new Eero home wifi network. I turned off "Ad blocking (beta)" in the Eero networking prefs. Upon doing so, the analytics.js loaded just fine.
Some other networking tools may have similar functionality, so check those out if the other solutions don't work.
来源:https://stackoverflow.com/questions/41983316/get-https-www-google-analytics-com-analytics-js-neterr-connection-refused