JavaScript 파일이 내 HTML 페이지 끝에로드됩니다.Google 애널리틱스 용 자바 스크립트와 귀하의 애널리틱스를 결합하십시오. (비동기 추적)
또 다른 스크립트에서 Google의 비동기 추적을위한 스크립트 코드를 추가하는 대신 두 스크립트를 함께 결합합니다. 그래서 그 대신이의
:
<html>
...
<script src="myScript.js">
<!-- google analytics -->
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXX-X']);
_gaq.push(['_trackPageview']);
(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';
(document.getElementsByTagName('head')[0] ||
document.getElementsByTagName('body')[0]).appendChild(ga);
})();
</script>
</html>
내가 내 'myScript.js'의 끝에서 두 번째 스크립트 태그 코드의 비트를 가질 것이다.
Google 문서에서 스크립트를 귀하의 것으로 결합하도록 제안한 곳을 하나도 발견하지 못했습니다.
이 문제를 어떻게 해결할 수 있습니까?
이 기술은 구글 분석 문서의에서 언급되지 않습니다 이유를 아시나요? 그들이 그것을지지하고 싶지 않은 것처럼 보입니다. – Zo72
@ lorenzo : 내 게시물에 대답 : http://stackoverflow.com/questions/2401308/2597908#2597908 –