Google Analytics Tracking Code Update

Google Analytics have just updated their tracking code snippet. GA team simply wanted to add some error handling to the JavaScript, so that if something goes wrong users will not see a warning message.

script-error1

The new snippet is shown below, with the additional code in bold:

<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-50020-1″);
pageTracker._trackPageview();
} catch(err) {}
</script>

Leave a Reply

Your email address will not be published. Required fields are marked *

*