Updated Google Analytics Code

Posted by jonathan at 7:17pm EST on 01/17/2009

PREFACE: You don’t have to upgrade if you don’t want to.

Google Analytics has updated the code you insert for tracking. But like the preface said, you don’t have to update your current code if you don’t want to.

Quickly, here is the new

[sourcecode lang="php"]

[/sourcecode]

Here is what Christina Park, of the Google Analytics team, says about the code update.

So why the change? Adding the try and catch to the snippet removes the possibility that your visitor sees a JavaScript message that doesn’t apply to her. It’s a fairly rare occurrence because messages like these (frequently in the form of an alert box) can only appear if JavaScript messaging has been enabled on the browser. Most browsers have JavaScript messaging turned off by default, but sometimes people unintentionally turn it on. For those visitors who have enabled messaging, the try and catch will have the effect of halting any messages from the Google Analytics tracking code snippet.

As a best practice, we’re including the try and catch in the snippet and updating our help materials to reflect this change.

So it’s not a revolutionary update and it’s not going to unlock a magical feature in your account, but it’s more fitting to standards and for those few visitors that like to have all messages enabled.

Incoming search terms:

  • update analytics code

No Responses to “Updated Google Analytics Code”

  1. Mike

    Jan 23rd, 2009

    “your visitor sees a JavaScript message that doesn’t apply to her.”

    I don’t understand – this only applies to female visitors? Odd way of phrasing that sentence. Why not just use the plural form of the word “them” if she was that scared of using the male form “him”.

  2. Jonathan Dingman

    Jan 23rd, 2009

    Yeah that is a bit weird. I don’t know why Christina wrote that.

Leave a Reply