Back in 2007 Google Analytics decided to switch over to ga.js, which is a new version of the javascript tracking code which is loaded through the snippet of code implemented on your webpages. Ga.js provides the functionality required for specific actions and events to be captured, processed and passed on to your Google Analytics reporting.
Although urchin.js continues to deliver the data just like it did in the early days of Google Analytics, there are some important benefits to updating your code to ga.js:
Continuing the use of urchin.js is not recommended. This what you should know if you do decide to continue using urchin.js:
Note: You can’t use both urchin.js and ga.js tracking codes together at the same time.
Switching from urchin.js to ga.js tracking code is easy. Just log in to your Google Analytics account, go to Analytics Settings and click on Edit for the website profile you’d like to update your tracking code for. In the top of the page, above the first table of website profile information you can click on “Check Status” and collect the ga.js tracking code. Now log in to your CMS (website backend system) or go through your HTML editor and overwrite the old urchin.js tracking code, save and publish/upload.![]()
The basic urchin.js tracking code looks like this:
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
try {
_uacct = "UA-#####-#";
urchinTracker();
} catch(err) {}</script>
The basic ga.js tracking code looks like this:
<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">
try {
var pageTracker = _gat._getTracker("UA-#####-#");
pageTracker._trackPageview();
} catch(err) {}</script>
If you’re using Wordpress on your blog and your tracking code is set up through a plugin based on the old urchin.js version you can simply update your plugin and it should switch to using the new ga.js tracking code. How can you tell which version is used? In both Internet Explorer and Firefox, simply load your website, go to View > Page Source and run a search (CTRL + F) for ‘urchin.js’ and/or ‘ga.js’.
I recommend using Yoast’s Google Analytics plugin for Wordpress.