Cast for two

Friday, December 14, 2007

New Analytics script not accepted by Blogger

Google asks to update the Google Analytics script to:

<script type=”text/javascript”>
var gaJsHost = (("https:" == document.location.protocol) ? " https://ssl." : "http://www.");
document.write("\<script src='" + gaJsHost + " google-analytics.com/ga.js' type='text/javascript'>\<\/script>" );

var pageTracker = _gat._getTracker(“UA-xxxxxx-x”);
pageTracker._initData();
pageTracker._trackVisit();
</script>

When entering this in to the Blogger HTML template, I get an error:


Open quote is expected for attribute "{1}" associated with an element type "type".

If you don't need the secure http access, you can simplify the script to:

<script src='http://www.google-analytics.com/ga.js' type='text/javascript'>
</script>
<script type='text/javascript'>
var pageTracker = _gat._getTracker("UA-xxxxxxx-x"); pageTracker._initData(); pageTracker._trackPageview(); </script>

Please only use the above code if you urgently want to test the new script. It might be wise to wait until the Google engineers have ironed out this issue if you do not want to put your huge analytics income at risk ;-)

No comments: