Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What, specifically, does the asynchronous code accomplish or allow that the older code does not?

share|improve this question
up vote 8 down vote accepted

The newer code uses the ability of modern browsers to execute Javascript aysnchronously from rendering the page (effectively, it is executed in another thread rather than the main page rendering thread).

This allows the code to be placed at the top of the page without impacting perceived page rendering performance.

This in turn means that partial page loads (e.g. someone hitting the "Stop" button, or navigating on to another page) are more likely to be captured by the script. With the old code, if the user navigates away before the JavaScript section is loaded and executed, it is possible for the page impression not to be recorded properly.

share|improve this answer
In the case of partial page loads (i.e. someone hits "stop" or the connection is lost), does Analytics report a pageview, or is there some facility for reporting a partial page load? – tnorthcutt Jul 13 '10 at 1:18
I don't know for sure, but I would imagine that it will be all-or-nothing. I think the asynchronous code just increases the chance that the page load will be logged. – Mark Hatton Jul 13 '10 at 9:56

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.