I was just trying to add another script to my site that recommends the defer parameter to be set. I’d have guessed that there’d be a third htmlOptions parameter on CClientScript::registerScriptFile(), but this is not the case. Would it make sense to add support for this to the core project?
I’ve resolved this in my own code by extending CClientScript and adding ClientScript::POS_END_RAW. Scripts in this category are simply printed out at the end of the page without any script tags… This may be a little more complex, but it adds a lot of versatility by allowing other forms of tracking. I’ve seen tracking scripts (for affiliate schemes and so on) that use whole hidden forms and single pixel transparent gifs for when scripts are disabled).