Pages

7.8.08

Errors in browsers after installing Google analytics Code

I am sure, those of you who use Google Analytics tool must have surely noticed the javascript error in browsers either in IE or Firefox or any,

The Error that is seen is "_gat undefined", And I am sure you must have noticed such error.

But no worries, you can find the answers from the http://groups.google.com/group/analytics-help-troubleshoot
/browse_thread/thread/011ea5c0c1582ea0

If browser is unable to access the javscript source, browser will display error as "_gat is undefined". And such happens due to firewalls, browser's extensions like AdBlock, No Script, filters not allowing the javascript source file to be loaded by browser.

So as a solution, You can see the following example,

<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">
if (typeof(_gat) == 'object') // See this line, here is the use of typeof(_gat)
var pageTracker = _gat._getTracker("UA-abeen0-X"); // replace with your own tracking code
pageTracker._initData();
pageTracker._trackPageview();
</script>

It should solve your problem of seeing error in your browsers.

No comments:

Post a Comment

Feel free to disagree with the contents but keep it polite, please!
The blogger reserves the right to moderate any abusive comment(s).