내 페이지의 헤드 부분의 끝에서 구글 분석 async site tracking script를 사용하는 경우, 모든 것이 예상대로 작동합니다로딩 구글 분석 매개 변수화 비동기 페이지 추적 스크립트
<head>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXX-X']);
_gaq.push(['_setDomainName', 'test.com']);
_gaq.push(['_trackPageview', '/title=ied&action=fire']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
피들러에서이 볼 수있는 2 개 요청 : 나는 스크립트를 필요로 몇 가지 이유를 들어
는 매개 변수화 할, 그래서 사용자 정의 googleAnalytics
함수 내에서 그것을 포장하는 GE의 TS 2 개 매개 변수 :
function googleAnalytics(domain, queryString) {
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXX-X']);
_gaq.push(['_setDomainName', domain]);
_gaq.push(['_trackPageview', queryString]);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
}
Abowe 코드가 GoogleAnalytics.js 파일에 저장되었습니다. 나는 다음과 같은 헤드 섹션의 페이지를로드 :
<head>
<script src="/script/GoogleAnalytics.js" type="text/javascript" language="javascript"></script>
<script type="text/javascript">googleAnalytics('test.com', '/title=ied&action=fire');</script>
</head>
하지만 이번에 들러는 1 요청을 보여줍니다
Google Analytics Tracking Code Debugger는 아무것도 보여주지합니다. ga.js 스크립트 만 다운로드되지만 Google 애널리틱스 보고서 데이터를 채우는 다른 요청은 없습니다. 이 접근법에서 무엇이 잘못되었으며 어떻게 해결 될 수 있습니까?
Btw :이 두 매개 변수와 추적 스크립트의 비동기 버전이 필요합니다.
감사합니다.