6
votes

Could anyone help me understand why this happens with google analytics code?

This is the error which then gives me to load the tracking code:

https://www.google-analytics.com/analytics.js Failed to load resource: net::ERR_CONNECTION_REFUSED

Is there any solution to this? I was trying to fix it all morning.

My situation:

If this error occurs, the tracking code does not work. So if events are monitored and callback functions specified in hitCallback property are never executed. When the causes a deficiency in the functionality of the website and also in tracking statistics.

Types of events that have failed me: behavioral events, events advanced electronic commerce (step forward cart).

My attempts:

I have disabled antivirus, antivirus firewall, Windows firewall and defend unsuccessfully thinking that could be. I installed the extention to debug google analytics. Googled for hours. I tried loading the code directly in the browser and on any pc I can get it. I could only get https://www.google-analytics.com/analytics.js making a wget from my server console. It could be a problem with the ISP?

Thank you very much!

Update:

Confirmed is the ISP. Although they have not solved in my case because the technician went on vacation.

If someone would come to have this problem, it occurs to me as a solution, edit the code tracking Analitycs to call a url eg "mydomain.com/analytics.js" it processor by modrewrite, and direct this request php file to download the actual file Js www.google-analytics.com/analytics.js and return in the response. As a proxy php. It's just an idea I have not tested. Thank you all, and may close this question if you want.

2
Is there an example page that this happens on? Can you also provide info on which browser, OS you are using? - Avi
hello, it happens in www.donagro.com.ar and www.martinmorris.com.ar. It happens in both chrome and firefox and ie, use microsoft windows. I attached a picture. image with error - Leonardo Jauregui
sorry @Avi, SO: win 7 ultimate x64 SP1 - Leonardo Jauregui
this is very weird. I tried to go to those same pages but did not see the errors. Could one of the following be an issue: 1) some kind of Ad block? 2) some kind of proxy that is blocking analytics or 3) some kind of proxy that is trying to MITM? (edit: you already mentioned that it is not firewall) - Avi
We are still investigating, and apparently the ISP is blocking the file ... we tested just now by other ISPs and had no problems. I'll make the claim. It is rare that only that javascript is locked. It has not happened to me with any other file so far. Maybe this javascript have some particularity as an obfuscation that is detected by some XSS filter? ... Who knows ... I thank you for your help! I hope you have a good day! - Leonardo Jauregui

2 Answers

2
votes

It can be that you are using a VPN(Virtual private network) which analytics blocks. Try loading https://www.google-analytics.com/analytics.js If it does not work, try disabling the VPN and try again

1
votes

Check your hosts file (on mac go finder > go > go to folder and paste there /etc/hosts | on windows search), in my case www.google-analytics.com was blocked in hosts file.