In case anybody's interested, I adapted Steve's example from the talk to make "good" Google Analytics tracker insert code, using DOM script insertion and script onload to activate the tracker. So, asynchronous lazy-loading goodness keeps GA out of the way of your pages loading fast! More info and code here.
I do wonder if Steve's using GA as his "bad" example will filter its way to the Urchin/GA team. It would be lovely for GA and maybe even Adsense (haha) to work sanely and efficiently out-of-the-box.
I implemented the onload technique for calling a function once a script has loaded and noticed my code only executed sometimes in IE.
I found that you need to check for *both* the "loaded" and the "complete" readyState's, otherwise your code block will not run when the external file you're loading has been cached.
Technique 5 has a major drawback: It tights the script to its name! If the user renames menu-degrading.js to menu-degrading-1.0.js the loading is broken
This comment has been removed by the author.
ReplyDeleteWhat happened to part one?
ReplyDeleteIt's supposed to be at http://www.youtube.com/watch?v=-QKebcaoUxg but there's a message saying it's been removed...
In case anybody's interested, I adapted Steve's example from the talk to make "good" Google Analytics tracker insert code, using DOM script insertion and script onload to activate the tracker. So, asynchronous lazy-loading goodness keeps GA out of the way of your pages loading fast! More info and code here.
ReplyDeleteI do wonder if Steve's using GA as his "bad" example will filter its way to the Urchin/GA team. It would be lovely for GA and maybe even Adsense (haha) to work sanely and efficiently out-of-the-box.
I implemented the onload technique for calling a function once a script has loaded and noticed my code only executed sometimes in IE.
ReplyDeleteI found that you need to check for *both* the "loaded" and the "complete" readyState's, otherwise your code block will not run when the external file you're loading has been cached.
Technique 5 has a major drawback: It tights the script to its name! If the user renames menu-degrading.js to menu-degrading-1.0.js the loading is broken
ReplyDelete