2007-12-15

Google Analytics tracker code changed

If you are using Google Analytics, make sure you update your code. The new code looks like this:

<script type="text/javascript">

var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");

document.write("\<script src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'>\<\/script>" );

<script>

<script type="text/javascript">

var pageTracker = _gat._getTracker("UA-123456-4");

pageTracker._initData();

pageTracker._trackPageview();

<script>

2 comments:

Cosmin Marginean said...

The old version (urchin code) still works. However, I couldn't find any clue related to how long will it take until the urchin-based code will be obsoleted, nor what are the "new features" that Google is talking about when recommending this new version.

Venci said...

They say that the Urchin code will work for about another year.
The benefits according to the documentation (http://www.google.com/analytics/GATCmigrationguide.pdf) are the following:
- Easily customize the tracking code for your site's needs.
- Conveniently set up e-commerce and cross-domain tracking.
- Quickly enjoy new features and reports as they roll out.