as soon as I did the basic content negotiation filters in PHP so that it would send the appropriate headers
if the client supported XHTML as well as only outputting the <?xml if the client supported XHTML, I
doesn’t exist in XHTML, after all.
The fix was simple, replace the current four line
inclusion code with:
var gaJsHost = (("https:" == document.location.protocol) ?
"https://ssl." : "http://www.");
var script = document.createElement("script");
script.src = gaJsHost + "google-analytics.com/ga.js";
will work fine, unless of course you have no head tag. In which case you should replace
getElementsByTagName(“head”) with getElementsByTagName(“html”).
Oh, man, how I hate Google Analytics' default code. Always have. TheReplyDelete
unnecessary usage of all those functions when it would suffice just to give a plain old <script
src=""> with a checkbox on the page to specify if SSL support is needed.
if I hate the default code, they should make it more DOM-compatible. document.write is not a very good way
to be doing things any more.
It really isn't. As far as I remember, Google Adsense isn't very W3C orReplyDelete
DOM friendly either.
It's a damn shame.