Google Analytics Asynchronous Code Helps Website Tracking & Improves Page Load Time

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:

  • Faster overall page load time
  • Improved data collection for short visits to rich media or script-heavy pages
  • Collecting (and retaining) user clicks that occur before the tracking code loads

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.
Asynchronous Code Experimental Results
The six combinations were:

  1. Traditional/ Synchronous code placed just before the </head> tag.
  2. Traditional/ Synchronous code placed just after the <body> tag.
  3. Traditional/ Synchronous code placed just before the </body> tag.
  4. Asynchronous code placed just before the </head> tag.
  5. Asynchronous code placed just after the <body> tag.
  6. Asynchronous code placed just before the </body> tag.

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.

Experimental Results

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%
Overall 1.021 0.847 17.03%


  1. Overall, the asynchronous version of the Google Analytics code is faster than Traditional/ Synchronous code by 17.03%.
  2. Placing the asynchronous version in any part of the file, does not significantly change the load time unlike the synchronous version.
  3. Putting the code on top of the page no longer slows the page. This is very important if tracking the click is as important as loading contents of the page. Incomplete page load is a major reason for disparity between GA visits and Google AdWords clicks.


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

Team Position²

Team Position²

Position² is an Accel-backed company that accelerates demand through Content Marketing, Paid Acquisition, and Marketing Technology services. Our solutions are mapped to customer lifecycles across touchpoints including search, social, mobile, media, email and powered by cutting-edge creative, web dev, analytics, and marketing automation. Startups to Fortune 500 companies across verticals rely on our marketing gurus, engineers, data scientists, writers and designers to rapidly deploy and scale integrated marketing campaigns.

  • Hi, very interesting test. Did you look into the analytics to check for any difference in the amount of tracked pageviews? Did the asynchronous code registor a higher level of pageviews?

  • Hi Jacob , this experiment was focused on page load time only. In future experiments I will try to find the difference between the two versions of GA code based on other parameters. keep your suggestions coming !

  • Vitor Lopes

    Hi, excelent test. Did you ran these tests on any other browsers?

  • SEO Boston


    Thank you very much for this Interesting and helpful post of Google analytics. I am getting a ‘0’ visit by a keyword in my Google analytics report. Could you please tell me the reason behind this? .


  • Pingback: Google Analytics Implementation Survey - Report | Position()