Saturday, December 22, 2007

Google Analytics Code Updated: Did you get the Memo?

I don't put ads on my blog. I don't need to track my blog's visitors and sources so I can optimize my marketing ad placements.

However, Google Analytics is just damn cool in its own right.

I really enjoy seeing what countries my blog visitors are coming from (Top 6: US, UK, Canada, Australia, Netherlands, Germany), which posts are the most popular, and which sites are linking to humble blog and sending visitors my way.  For a geek and a Reformed Sociology major, it is really fun.

So this morning I was reviewing the week's stats and was surprised not to see (I don't know why) that my post detailing the conflict between Comodo firewall 3.0 and Vista KB942763 failing didn't even break the top 25 posts this week.

And since I had been seeing the top posts and referrers not change at all for the past month or more, I began to wonder if something had broken with my Google Analytics code (it hadn't...those posts are just popular for a reason).

While researching, I found the following link: Which version of the tracking code am I using?

You mean there are more than one?

I didn't get the memo!

The Update

Turns out that there is..and it got quietly released mid October 2007: 

Google Analytics Update - Google Analytics News

GA.JS: New Google Analytics Tracking Code - Analytics Talk blog

And, a new version release of the GA.JS code got released just this week.

Updated GA.JS Tracking Code - Analytics Talk blog

The Old GA Code

I had been using the old version:

Older Version of the Google Analytics Tracking Code
<script type="text/javascript" src=" http://www.google-analytics.com/urchin.js "></script>
<script type="text/javascript">
_uacct = "UA-xxxxxx-x"
urchinTracker();
</script>

The New GA Code

So I switched it to this new code in my Blogger template HTML 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-xxxxxx-x");
pageTracker._initData();
pageTracker._trackPageview();
</script>

Just be sure you insert your own, personal User Agent profile id code where the UA-xxxxxx-x field is listed in the code.  Otherwise GA doesn't work too effectively with the default value listed there.

Why Change?

Well, you don't have to if you don't want to.

The old Urchin-Tracker code works fine, still (for now).  But the new code now supports event tracking and (from what I read) calls to the more efficient GA.JS script. So maybe your visitors won't get page-load delays while Google Analytic's JavaScript is executing.

Anyway, now you got the memo. 

Upgrade if you want...at least you know.

For more information about Google Analytics, this blog is pretty snazzy: Analytics Talk

--Claus

No comments: