Update your Google Analytics Tracking Code

Just in case you missed the announcement from Google Analytics, they have just updated their tracking code snippet. The snippet is a couple of bits of JavaScript that first download the relevant copy of the analytics code (depending whether your site is SSL protected or not – so they don’t see security warnings from their browser) and then registers the visit with Google.

The change is simply to add some error handling to the JavaScript, so that if something goes wrong users will not see a warning method.

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 +

<script type="text/javascript">
    try {
        var pageTracker = _gat._getTracker("UA-50020-1");
    } catch(err) {}

(I’ve just applied the change to the DSpace code repository, ready for the upcoming 1.5.2 release)topodin.com

4 thoughts on “Update your Google Analytics Tracking Code

Leave a Reply

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