Google Analytics Fixes Rare Javascript Message!

Jan 20, 2009 | 2,301 views | by Navneet Kaushal
VN:F [1.9.20_1166]
Rating: 0.0/5 (0 votes cast)

Google Analytics has come up with an update on the code snippet that is placed on websites. The update is done to fix the rare display of a JavaScript message that was usually noticed by the users to sites using Google Analytics.

But why was it changed?

“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.”

<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>

You just need to log into your Google Analytics account to access your account-specific code snippet.

4.thumbnail Google Analytics Fixes Rare Javascript Message!

Navneet Kaushal

Navneet Kaushal is the founder and CEO of PageTraffic, an SEO Agency in India with offices in Chicago, Mumbai and London. A leading search strategist, Navneet helps clients maintain an edge in search engines and the online media. Navneet's expertise has established PageTraffic as one of the most awarded and successful search marketing agencies.
4.thumbnail Google Analytics Fixes Rare Javascript Message!
4.thumbnail Google Analytics Fixes Rare Javascript Message!