There's just one catch. The new code does not validate in XHTML. It doesn't publish correctly within Blogger templates. And some web developers say it doesn't work in ASP websites.
Given that Google recommends using valid X/HTML to promote better search ranking and improved user accessibility, one would think the code they provide for use on millions of web sites should validate. Fortunately, there is a relatively easy fix by inserting CDATA tags (shown in red text) to your tracking code.
XHTML compliant version of the GA.js code:
<script type="text/javascript">
//<![CDATA[
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">
//<!--[CDATA[
var pageTracker = _gat._getTracker("UA-XXXX-XX"); pageTracker._initData(); pageTracker._trackPageview();
//]]-->
</script>



© 1995-2009 |