The Piwik community doesn’t seem to have much mention of this, other than one mailing list thread. I modified the script to something similar to the one in that thread, like this:
This inserts an element with the appropriate content into the DOM instead of writing it directly to the page, which would be considered the preferred way these days anyway.
All this trouble makes me wonder why I should bother with XHTML 5 anyway. Browsers simply give an often useless warning when there’s an error in the markup, and don’t display the page at all. Firefox at least doesn’t even let you view the source, making it very difficult to figure out where the issues is. IE cannot render it properly and must be sent a different MIME and doctype. HTML 5 can be basically the same but without some of the constraints. However, I like the XML syntax and would rather serve my document as the type of content it is marked up as. I like to know that there are well-formedness errors, even if I’d prefer them to be handled differently. I like being able to easily use my same layout in an XSLT, such as for my xml sitemap. For clients, I will use HTML, since I don’t want their site to stop working because of a small markup error. But for my own site, I will continue to use XTML.