7 April 2010
Google Analytics is a very good statistical analysis service which is widely used by websites that want to keep track of user activity. The downside is that Analytics slows down the loading of each page by about 150ms. A sixth of a second isn't enough for anyone to notice, but when multiplied by a (hypothetical) billion page loads per day, it adds up to one lifetime every fortnight. Let's speed things up a bit and save lives.
In all three methods (classic, asynchronous and deferred) the browser is doing exactly the same work, so the total times are similar. But in the deferred method there is no added delay before the page finishes loading and is ready for user interaction.
Here is the code:
The lava lamp centrifuge was more popular than I expected. It has received 280,000 views so far, resulting in a saturated Internet connection. I've also been invited to demo it for Yuri's Night at NASA Ames this weekend. See you there!