I don't see that this method guarantees anything when it comes to browser cache...? If it requests an image, for instance, the browser might still elect to serve that image from cache, regardless of whether the request originates from an IMG tag in the original source, or a document.write
-written IMG tag.
My best guess is that they want the script to be self-contained and easy to deploy. A lot of the times (and for obvious reasons) the script referenced (eg. the URL to which the image points) is different depending on whether or not the current page is loaded over a secure HTTPS connection. If the current page is a https-page, load https://omniture.com/xxx
, otherwise, load http://omniture.com/yyy
. That's very easy to achieve in javascript, but you cannot hard code it in HTML. Given any server side language, it'd be equally easy to achieve, and that would be preferable, but I figure they don't want to say "go on and implement this functionality in whatever way you prefer", but rather, they want to deliver a solution that works as well as possible, regardless of the environment, and with as few dependencies as possible.