Google Analytics Fixes Rare Javascript Message!

Jan 20, 2009 | 985 views | by Navneet Kaushal
VN:F [1.9.13_1145]
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.

Recommend this story

Navneet Kaushal

About the author:

Navneet Kaushal, CEO PageTraffic is a trusted authority in the search engine marketing industry. He is a featured author at Web Pro News, Search Newz, Promotionworld, Website Notes, DevWebPro, SEO Article and Web Help Now among many others. Follow Navneet Kaushal on Google +.

Related Articles

  • No Related Post

Leave a Comment