Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

analytics.js net::ERR_CONNECTION_REFUSED

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.

like image 334
Leonardo Jauregui Avatar asked Jul 21 '16 15:07

Leonardo Jauregui


2 Answers

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

like image 112
Sharthan Avatar answered Nov 03 '22 15:11

Sharthan


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.

like image 2
Zahar Avatar answered Nov 03 '22 16:11

Zahar