New addition to Google Analytics GA.js Code
I was recently checking out the Official Google Analytics Blog and found that they’ve made an addition (in terms of code) to the GA.js, GATC (Google Analytics Tracking Code).
Original GA.js Tracking Code
<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">
var pageTracker = _gat._getTracker("UA-XXXXXXX-X");
pageTracker._trackPageview();
</script>
New GA.js Tracking Code
<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-XXXXXXX-X");
pageTracker._trackPageview();
} catch(err) {} </script>
The addition of the Try Catch statement allows you to NOT display JavaScript alerts to the visitors on your website that otherwise they may see. Have a read of the original article here . Hope that you found this helpful!
Luc


I’ve been using analytics for quite some time now and haven’t noticed this or read about this anywhere but here! Thanks for this wonderful find!