News & Events
Google Analytics introduced asynchronous tracking in Dec 2009 as an “alternate way to track your website”. According to Google, this code is processed separately and can execute without blocking other code or content. This allows the Analytics code to be placed higher in the page, unlike the traditional code.
The asynchronous tracking snippet is said to offer the following benefits:
We decided to test Google’s claim that the new code snippet improves page load time. Here’s what we found.
Problem: To study the effect of using the asynchronous code as against the traditional code on page load time.
Hypothesis: Page load time with the traditional code will be higher (i.e. the page will take longer to load) than with the asynchronous code in all possible placements of the codes.
Limitation: The experiment does not attempt to study the effect of the codes on script-heavy or rich media pages. It also does not attempt to study tracking errors when the script has not fully loaded.
Methodology: Six simple HTML pages were created and tested on a local Apache server. Each page consisted of a single line of text and a Google Analytics code. The only difference between the pages was the version of Google Analytics Code being used and its placement.
The six combinations were:
Ten readings of “page load time” were taken for each page using the Firebug add-on. Browser cache was cleared prior to each reading to ensure that page was not loaded from the cache.
|Code Placement||Sync Code||Async Code||% Improvement|
|Page||Avg Page Load Time (in sec)||Page||Avg Page Load Time (in sec)|
|Inside <head></head> Tags||S1.html||1.05||A1.html||0.855||18.53%|
|Just After <body> Tag||S2.html||1.175||A2.html||0.847||27.93%|
|Just Before </body> Tag||S3.html||0.838||A3.html||0.839||-0.12%|
The overall results support Google’s claim that asynchronous Google Analytics code improves page load time. We recommend that the traditional synchronous code be slowly phased out and the asynchronous code be adopted
This is especially important in paid campaigns where cost per click is being analyzed and where the Google Analytics code should be placed in the header. In today’s internet scenario where users expect to see instant page loads, this is a welcome move by Google
We’ll be testing the other claims that Google makes about its asynchronous page tracking code. Watch out for the next one!
Contributed by Ravi Shukla, Analytics Team