Mile High Tech Guy - Jeff Kemp's Tech Blog
Subscribe

Tuesday, July 22, 2008

_gat error message - Troubleshooting | Google Groups

_gat error message - Troubleshooting | Google Analytics:

"_gat not defined"


Google Analytics causes some errors (visible by seeing the 'Done, but with errors' type of message in lower part of Internet Explorer 7, or Firebug in Firefox.

Looks like the Google script does not validate if the actual tracking script is already loaded before it is executed.

There are several fixes and work-arounds out there, but I tried several and this is the only code that ultimately worked for me:


<script src="http://www.google-analytics.com/ga.js" type="text/javascript"></script>
<script type="text/javascript">
if (typeof(_gat) == "object") {
var pageTracker = _gat._getTracker("UA-XXXXXX-1");
pageTracker._initData();
pageTracker._trackPageview();
}
</script>


Be sure to replace the "UA-XXXXXX-1" with your Google Analytics account number, and also insure the carriage return does not add any extra spaces.



Jeff Kemp (Golden, CO), www.jeff-kemp.com.

No comments:

My LinkedIn Network Updates

AppleGazette

Yahoo! Finance Badge (Apple stock)