New Google Analytics Tracking Code - GA.JS

December 20th, 2007 by SpiderSavvy

Today I replaced my GA (Google Analytics) with thier new GA.JS. I will now be able to:

  • The ability to track events
  • New object oriented style; no more functions like urchinTracker()
  • Smaller size for faster downloads

I’ve noticed, in the past, that my pages have been slowing down just a bit. But, since i really need the data I don’t worry about it too much. We will see how much quicker the new codes is. Actually, I should do an experiment; place the old code and new code on a page with the same HTML and get an average load time. How about that for inquiry based learning! ;)

Old Code
<script src=”http://www.google-analytics.com/urchin.js” type=”text/javascript”>
</script>
<script type=”text/javascript”>
_uacct = “UA-1425248-11″;
urchinTracker();
</script>

New code
<script type=”text/javascript”>
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”>
var pageTracker = _gat._getTracker(”UA-1425248-11″);
pageTracker._initData();
pageTracker._trackPageview();
</script>

Source: http://www.epikone.com/blog

Posted in Analytics

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.

About SpiderSavvy Blog

There is a lot of internet out there so I figured I'd use this space to talk about things I've seen and heard. I might even say some thing funny every now and then!