You might have noticed that the new version of Google’s Analytics tracking code (ga.js) doesn’t validate using the W3C Validation tool. For those of us who like to write valid code there is an answer.
Look for this line in your ga.js code:
<code>document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));</code>
Replace it with this line:
<code>document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));</code>
By converting the “\” and the “/” to their ASCII counterparts we’re able to get the ga.js code to validate.
Enjoy!
UPDATE: Google has updated Analytics to include this mod so just download a new copy from your account and use that!
Leave a reply