The Ashes

Technology, Science and other news
April 17, 2009

Speeding Up Urchin with Dojo, Part 2

Posted by : admin
Filed under : General

Last year, we covered Pete Higgin’s blog talking about how to load Google Analytics in a more responsive manner. Google may not have improved the situation since then (really?), but the Dojo folks have packaged up Pete’s script into the recently released Dojo 1.3 and Alex Russell recently posted a great summary of issues with Google Analytics and an example of the new code:

[Google Analytics] but it tends to load slowly. There are several reasons for this:

  • Another DNS lookup to resolve http://www.google-analytics.com/. This DNS entry is likely to be “warm” given how frequently ga.js is used on the web, but as Jim Roskind explained on the Chromium blog, it’s the outliers that kill you.
  • It’s kinda big. At 9K on the wire (22K unzipped), ga.js is kinda chunky for what it does most of the time, namely tracking a single page load.
  • The default instructions are bone-headed. They direct you to do a document.write() which is a blocking, synchronous operation WRT page loading. This is tres dumb. Reasonable people should just include ga.js with a <script> tag, but nearly nobody does. Turns out that sane defaults still matter.
  • Load times seem totally random. As with DNS lookup, ga.js’s latency varies wildly. This isn’t backed up by anything empirical, but many pages feel blocked by ga.js for a near eternity.

The code is now simplified into this:

PLAIN TEXT
HTML:

  1. <script type=“text/javascript”
  2.   src=“http://ajax.googleapis.com/ajax/libs/dojo/1.3/dojo/dojo.xd.js”>
  3. </script>
  4. <script type=“text/javascript”>
  5.   dojo.addOnLoad(function(){
  6.     setTimeout(function(){
  7.       dojo.require("dojox.analytics.Urchin")
  8.       dojo.addOnLoad(function(){
  9.         var tracker = new dojox.analytics.Urchin({
  10.           acct: "UA-XXXXXX-X" // your tracking # here
  11.         })
  12.       })
  13.     }, 100)
  14.   })
  15. </script>

Check out Alex’s blog entry for more details.

Tags :

No Comments

(required)
(will not be published) (required)
(opitional)

cciash.com EN ES IT DE PT CZ FR RU
June 2018
M T W T F S S
« Sep    
 123
45678910
11121314151617
18192021222324
252627282930  

Pages

Categories

Resources

There are many online poker site where you can play but at poker.hk you can play the poker games with all the knowledge you need related to the game with the poker school available in both the English and Chinese language.

Super Casino

Now you can bet on any sports and any sporting events from all the comfort from your home. Bet770 allows you to bet on any events and match with in just 3 clicks. They also offers great odds on football betting for every premier and champions league match. Get £50 free in bets when you register.

Bingo770, offering best online bingo games with £7.70 free no deposit Bonus!