views:

3886

answers:

4

Today Google announced the support for asynchronous Google Analytics tracking.

The asynchronous tracking is achieved using the async directive for the <script> tag.

Which browsers support the async directive (<script async="true" />) and since which version?

+1  A: 

There's a Wikipedia entry for HTML5 browser support. At this point in time, it appears that only the Gecko engine supports it. Gecko is the engine used in Firefox.

Jordan Ryan Moore
+8  A: 

From your referenced page:

Firefox 3.6 is the first browser to officially offer support for this new feature. If you're curious, here are more details on the official HTML5 async specification.

tvanfosson
.........Where? :)
Shoban
4th paragraph, last sentence.
tvanfosson
@tvanfosson - hope you don't mind, edited in the link from that page for you.
Dominic Rodger
@Dominic -- thanks for the update. I was working on it, but you beat me to it.
tvanfosson
Sorry I thought you wanted to add a link to "here are more details" :)
Shoban
@tvanfosson - no problem :)
Dominic Rodger
"this new feature" is referring to the HTML5 async attribute. The Google Analytics async snippet is supported by all browsers.
Brian
A: 

This is from Google

"The second half of the snippet provides the logic that loads the tracking code in parallel with other scripts on the page. It executes an anonymous function that dynamically creates a element and sets the source with the proper protocol. As a result, most browsers will load the tracking code in parallel with other scripts on the page, thus reducing the web page load time. Note here the forward-looking use of the new HTML5 "async" attribute in this part of the snippet. While it creates the same effect as adding a element to the DOM, it officially tells browsers that this script can be loaded asynchronously. Firefox 3.6 is the first browser to officially offer support for this new feature. If you're curious, here are more details on the official HTML5 async specification. "

jarrett
can we have a link for that?
David Kemp
oh, found it: http://googlecode.blogspot.com/2009/12/google-analytics-launches-asynchronous.html
David Kemp
+12  A: 

The async support as specified by google is achieved using two parts:

  • using script on your page (the script is supplied by google) to write out a <script> tag to the DOM.

  • that script has async="true" attribute to signal to compatible browsers that it can continue rendering the page.

The first part works on current browsers. The second part only affects Firefox 3.6. However, the first part also allows rendering before waiting for ga.js to be retrieved from google.

Philip Rieck
I'm not sure you even need async="true", you can just write 'async'
vsync
so if i generate the script tag like google does it - what would be correct: var s = document.createElement('script'); s.async='true';s.async=true; (google does it that way) or s.async='async'; ?
Tobias