developer tip

Google Analytics-리소스로드 실패 : http://www.google-analytics.com/ga.js

optionbox 2020. 8. 25. 07:54
반응형

Google Analytics-리소스로드 실패 : http://www.google-analytics.com/ga.js


지금까지 Chrome 콘솔에서이 오류를 발견했습니다.

여기에 이미지 설명 입력

을 사용하기 때문에 오류를 기록하도록 Google의 스크립트를 수정했는데 이것이 try{} catch{}내가 얻은 것입니다.

여기에 이미지 설명 입력

나는 통계에서 상당한 변화를 보지 못했습니다 . 항상 기복이 있습니다.

또한 이것은 내 사이트뿐만 아니라 모든 곳에서 놀랍습니다. 버그 보고서 나 그와 비슷한 것을 찾지 못했습니다.

브라우저에서 http://www.google-analytics.com/ga.js 로 이동하면 정상적으로로드됩니다.

누구든지 이것이 원인에 대한 단서가 있습니까?


AdBlock의 문제였습니다. 나는 그것을 비활성화하고 이제 정상적으로로드합니다.

yagudaev 는 AdBlock이 Google Analytics를 차단하지 않도록하기 위해 제공된 스 니펫을 편집하고 https://기본적으로 프로토콜 기준 URL 대신 명시 적으로 사용해야한다고 제안합니다 (아래 답변 참조) . 이것은 변화를 의미합니다

'//www.google-analytics.com/analytics.js'

으로

'https://www.google-analytics.com/analytics.js'

예:

<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-XXXXX-XX', 'auto');
  ga('send', 'pageview');
</script>

호스트 파일 일 수도 있습니다. 여기에 있습니다.

$ grep -ni "google-analytics.com" /etc/hosts
6203:# 127.0.0.1  ssl.google-analytics.com #[disabled = Firefox issues]
6204:127.0.0.1  www.google-analytics.com #[Google Analytics]

오프라인 앱인 경우 (즉, 캐시 매니페스트를 정의한 경우) 네트워크 요청을 허용해야합니다.

Google Analytics에 문제를 일으키는 HTML5 Appcache 보기


문제가 발생하는 이유는 AdBlock이이 스크립트가 통과하지 않는 경우에만이 스크립트를 차단하기 때문 https입니다. 오류가 발생하면 http:프로토콜 참조 가 포함되어 있습니다 .

All you need to do is change the snippet to force it to go through an ssl connection by adding an explicit protocol instead of the protocol relative url that is the default.

<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-XXXXX-XX', 'auto');
  ga('send', 'pageview');
</script>

This error is commonly caused due to one of the extensions installed within Chrome.
There are a few ways to debug and solve an ERR_BLOCKED_BY_CLIENT message.

  • Disable the extension.
  • Whitelist the domain.
  • Debug the issue.

I would recommend to find more detail at How to Solve ERR_BLOCKED_BY_CLIENT


I've noticed same thing on my browser some time ago. Did you sing in to chrome using your Google account maybe? Or did you choose in any way to opt-out from collecting data on Google Analytics ?

Maybe Google remembers that option and uses it on Chrome when you are singed in..

BTW. I can normally open http://www.google-analytics.com/ga.js in browser, it just doesn't work when automatically loaded.


Ensure Fiddler (or similar proxy) is not active.


2019 update

This has become very widespread now.

Solutions

  1. Ask people to unblock your website, (bad idea from personal experience)
  2. Host google analytics script locally (bad idea) because google says so HERE

Referencing the JavaScript file from Google's servers (i.e., https://www.googletagmanager.com/gtag/js) ensures that you get access to new features and product updates as they become available, giving you the most accurate data in your reports.

  1. 서버 측 분석을 사용하십시오. 이것이 오늘날 사람들이하는 일입니다. node.js에있는 경우 분석 또는 범용 분석 과 같은 라이브러리를 사용하십시오.

참고 URL : https://stackoverflow.com/questions/9618818/google-analytics-failed-to-load-resource-http-www-google-analytics-com-ga-j

반응형