Don't merge seperated Google analytics javascript. English Posting

I was a idiot. Yeah.. I thought if I merge two Google analytics javasciprt section to one, it would be helpful to reduce our CLIK loading time like below:

Original:
<script type="text/javascript">
        //google analytics enabling code
        var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
        document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
        try {
          var pageTracker = _gat._getTracker("UA-XXXXXXX-1");
          pageTracker._trackPageview();
        } catch(err) {}
</script>

My mistake:
<script type="text/javascript">
        //google analytics enabling code
        var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
        document.write(unescape("%3Cscript src='" + gaJsHost +"google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));

        try {
          var pageTracker = _gat._getTracker("UA-XXXXXXX-1");
          pageTracker._trackPageview();
        } catch(err) {}
</script>

Since I did it (May 24), our access statistics in Google analytics shows wrong result. During the period CLIK never had serviced anything to user according to the alaytics. But our team accessed CLIK and some our user also use CLIK during the period. (May 25 ~ June 2)
I re-changed it in June 3, then it works correclty. :-)

트랙백

이 글과 관련된 글 쓰기 (트랙백 보내기)
TrackbackURL : http://classpath.egloos.com/tb/4987728 [도움말]

덧글

  • 2009/06/05 14:09 # 삭제 답글

    저 두개가 먼차이 죠 ?
  • 허진영 2009/06/16 09:10 # 답글

    그냥 추정이다만 첫번째에 보면 document.write ... 부분이 보이지? 그 부분이 호스트 타입에 따른 적절한 자바스크립트를 불러오도록(쓰도록)하는 부분인데, 오리지날 부분에는 그걸쓰고 일단 자바 스크립트 태그를 한번 닫고, 내가 수정했던것에서는 닫지않고 바로 다음 코드가 이어지지. 그런데 그 다음코드에서 앞의 document.write 로 삽입(?)한 자바스크립트 내의 코드를 호출하도록 되어있는거야. 닫고 다시 연 후 호출하면 해당 객체가 이미 잘 불려있는 상태, 닫지 않고 하면 해당 객체가 없는 상태 그래서 에러가 나야하지만 try/catch 로 감싸 두었으니 에러가난지 몰랐던것.
덧글 입력 영역


구글애드센스