2013-02-21 2 views
0

Google 웹 로그 분석 코드의 다음 줄이 수를 단축?Google 웹 로그 분석 코드

전체 스크립트는 다음과 같습니다 : 이렇게하면 예를 들어 서버를 테스트하기 위해 file: 프로토콜을 사용하여이 파일을로드하는 경우

<script type="text/javascript"> 

    var _gaq = _gaq || []; 
    _gaq.push(['_setAccount', 'UA-XXXXXXX-X']); 
    _gaq.push(['_setDomainName', 'example.com']); 
    _gaq.push(['_trackPageview']); 

    (function() { 
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; 
    ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js'; 
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); 
    })(); 

</script> 

답변

4

Protocol Relative URL이라고하며 Google 애널리틱스 코드를 줄이면 IE6에 몇 가지 문제가 발생할 수 있습니다. 구글 @Protocol-Relative URLs를 사용하여 폴 아일랜드어에서

:

비 'ssl '하위 도메인에서 일부 보안 설정에서 ... 날려 버릴 수있는 대화 상자를 발생 IE6의 edgecase 버그가 있습니다

. IE6에 신경 쓰지 않는다면 GA 스 니펫에서 40 바이트를 가져와도됩니다. 그렇지 않으면 해당 삼자 연산자가 필요할 것입니다. :)

1

은 작동하지 않습니다. 그 작은 문제 외에도 잘 작동해야합니다.