async versus sync

Some of you might be wondering why I bothered adding an author field in the article info section. I always write the stuff on here myself, right? Today I can finally reveal the purpose of this illustrious addition: this blog was built with the possibility of guest bloggers in mind. Now is the time to make good use of this feature, so bear with me and let yourself be swept away by the Analytics team of Internet Architects.

to sync or to async?

We at the Internet Architects WebAnalytics department - WAIA in short - are serious about data and data quality. That's why we were all excited about the release of the Google Analytics Asynchronous tracking code snippet in December 2009. The benefits seemed obvious, as stated on Steve Souders' blog:

  • Faster page loads and improved uptime: the script now loads without blocking the downloads of other resources.
  • More data equals more accurate results as early click-aways will now be measured more accurately compared to the synchronous tracking snippet.

The first benefit seems clear: the asynchronous script call leads to ga.js being downloaded parallel to other resources - a good thing for a functional website script as the tracking code adds no new content to a page. After the script is fully downloaded the page view calls (and other GA methods) will be executed.

So how to verify whether the accuracy of data generated by the asynchronous tracking code is more accurate than the data generated by the synchronous tracking code? The answer is simple: the improved tracking code should track more page views and visits since there is less data loss due to early-click aways from pages.

Below you can find a test, set up to verify this improved data accuracy. After all, in a web analytics environment the data itself is already quite the subject of discussion, so let's try to make sure we don't pollute our messy data even more.

synchronous versus asynchronous tracking code snippet

We performed the test on this very blog. The test was implemented as follows:

  • Leave the current tracking code as-is: synchronous and implemented inline before the closing body-container.
  • Add the asynchronous tracking code as additional measurement (using a different UA) before the closing head-container, as prescribed by Google Analytics.
  • Check results in the GA front-end.

Following the async code's raison d'être we expected the traffic data to be more or less the same, with slightly more traffic measured by the asynchronous tracking code as this version is supposed to have lesser data loss due to early click-aways. The actual results looked like this:

Synchronous: 17305 visits / 31891 pageviews
Asynchronous: 17968 visits / 30203 pageviews

Visits: more data measured with the asynchronous tracking code.
Page views: less data measured with the asynchronous tracking code.

The results for measured visits are in line with the expectations: more visits are recorded by the asynchronous tracking code snippet because early click-aways are recorded more accurately. However we didn't expect to see that more page views would be measured by the synchronous code. Following the same logic as before we would expect to see a rise in page views equal to the higher amount of visits.

So we performed a more detailed check, comparing the results on a day-per-day basis:

segment: all visits

visitspageviews
datesyncasyncdeltasyncasyncdelta
12-aug-2010 42246442 70574944
13-aug-2010 40045454 69470612
14-aug-2010 22927546 32439066
15-aug-2010 285242-43 680481-199
16-aug-2010 4014010 63369966
17-aug-2010 37842749 73676832
18-aug-2010 38141130 658656-2
19-aug-2010 37839517 64066828
20-aug-2010 30135857 52555631
21-aug-2010 17218715 27431036
22-aug-2010 2452450 462415-47
23-aug-2010 3803844 662643-19
24-aug-2010 3903922 683653-30
25-aug-2010 37041949 64669852
26-aug-2010 32233715 5465460
27-aug-2010 30435349 45653175
28-aug-2010 2022086 361322-39
29-aug-2010 233202-31 370311-59
30-aug-2010 354350-4 568556-12
31-aug-2010 40942819 816793-23
01-sept-2010 37039525 761748-13
02-sept-2010 37640125 60165756
03-sept-2010 32035838 53356633
04-sept-2010 21423218 379347-32
05-sept-2010 2192234 36237614
06-sept-2010 36037111 635626-9
07-sept-2010 41542813 825806-19
08-sept-2010 37340633 72274220
09-sept-2010 38140625 607585-22
10-sept-2010 33037040 51755437
11-sept-2010 2002000 468418-50
12-sept-2010 213211-2 33835012
13-sept-2010 3803888 643599-44
14-sept-2010 460458-2 814714-100
15-sept-2010 39744346 77987192
16-sept-2010 4644695 880837-43
17-sept-2010 31439581 526651125
18-sept-2010 21622610 335329-6
19-sept-2010 265240-25 398308-90
20-sept-2010 4504555 7357438
21-sept-2010 41546651 73375320
22-sept-2010 4644640 1013998-15
23-sept-2010 42547449 7917965
24-sept-2010 34939950 71774831
25-sept-2010 21724629 37541237
26-sept-2010 251238-13 429358-71
27-sept-2010 411406-5 718615-103
28-sept-2010 38844355 676809133
29-sept-2010 372371-1 721661-60
30-sept-2010 42045434 73477541
total 1698517968983 3020430203-1

In the table above, a green table cell in the delta column indicates an expected result (more data measured by asynchronous code). A red table cell indicates an unexpected result (more data measured by the synchronous code).

These results are more or less consistent with previous findings, but they still offer little in the way of explanation as we encounter plenty of fluctuations in the delta columns. We had to dig deeper, finding a way to evaluate the performance of the measurements of early click-aways of the GA async code versus the sync tracking code. The closest match was to segment on bounced visits versus not bounced visits within GA:

  • Bounced visits segment: Number of page views equals 1.
  • Non bounce-visits segment: GA built-in segment.

These are the results summed up in two tables.

segment: bounced visits

visitspageviews
datesyncasyncdeltadelta%syncasyncdeltadelta%
12-aug-2010 3093615216,8% 3093615216,8%
13-aug-2010 2913647325,1% 2913647325,1%
14-aug-2010 1852254021,6% 1852254021,6%
15-aug-2010 223193-30-13,5% 223193-30-13,5%
16-aug-2010 311329185,8% 311329185,8%
17-aug-2010 2683215319,8% 2683215319,8%
18-aug-2010 2843244014,1% 2843244014,1%
19-aug-2010 285313289,8% 285313289,8%
20-aug-2010 2262845825,7% 2262845825,7%
21-aug-2010 1391551611,5% 1391551611,5%
22-aug-2010 184199158,2% 184199158,2%
23-aug-2010 296312165,4% 296312165,4%
24-aug-2010 285299144,9% 285299144,9%
25-aug-2010 2793345519,7% 2793345519,7%
26-aug-2010 240263239,6% 240263239,6%
27-aug-2010 2362794318,2% 2362794318,2%
28-aug-2010 1521691711,2% 1521691711,2%
29-aug-2010 180161-19-10,6% 180161-19-10,6%
30-aug-2010 262273114,2% 262273114,2%
31-aug-2010 2883233512,2% 2883233512,2%
01-sept-2010 268294269,7% 268294269,7%
02-sept-2010 2933243110,6% 2933243110,6%
03-sept-2010 2352784318,3% 2352784318,3%
04-sept-2010 1611872616,1% 1611872616,1%
05-sept-2010 158170127,6% 158170127,6%
06-sept-2010 270289197,0% 270289197,0%
07-sept-2010 2923273512,0% 2923273512,0%
08-sept-2010 2753143914,2% 2753143914,2%
09-sept-2010 2953364113,9% 2953364113,9%
10-sept-2010 2563024618,0% 2563024618,0%
11-sept-2010 14315185,6% 14315185,6%
12-sept-2010 16316521,2% 16316521,2%
13-sept-2010 291315248,2% 291315248,2%
14-sept-2010 356371154,2% 356371154,2%
15-sept-2010 2953465117,3% 2953465117,3%
16-sept-2010 324351278,3% 324351278,3%
17-sept-2010 2313077632,9% 2313077632,9%
18-sept-2010 1641852112,8% 1641852112,8%
19-sept-2010 19920121,0% 19920121,0%
20-sept-2010 34034551,5% 34034551,5%
21-sept-2010 2963636722,6% 2963636722,6%
22-sept-2010 333349164,8% 333349164,8%
23-sept-2010 3113716019,3% 3113716019,3%
24-sept-2010 2463035723,2% 2463035723,2%
25-sept-2010 1642003622,0% 1642003622,0%
26-sept-2010 18919784,2% 18919784,2%
27-sept-2010 312331196,1% 312331196,1%
28-sept-2010 2893405117,6% 2893405117,6%
29-sept-2010 261272114,2% 261272114,2%
30-sept-2010 3093655618,1% 3093655618,1%
total 1264214130148811,8% 1264214130148811,8%

segment: non-bounced visits

visitspageviews
datesyncasyncdeltadelta%syncasyncdeltadelta%
12-aug-2010 113103-10-8.8% 396388-8-2.0%
13-aug-2010 10990-19-17.4% 403342-61-15.1%
14-aug-2010 4450613.6% 1391652618.7%
15-aug-2010 6249-13-21.0% 457288-169-37.0%
16-aug-2010 9072-18-20.0% 3223704814.9%
17-aug-2010 110106-4-3.6% 468447-21-4.5%
18-aug-2010 9787-10-10.3% 374332-42-11.2%
19-aug-2010 9382-11-11.8% 35535500.0%
20-aug-2010 7574-1-1.3% 299272-27-9.0%
21-aug-2010 3332-1-3.0% 1351552014.8%
22-aug-2010 6146-15-24.6% 278216-62-22.3%
23-aug-2010 8472-12-14.3% 366331-35-9.6%
24-aug-2010 10593-12-11.4% 398354-44-11.1%
25-aug-2010 9185-6-6.6% 367364-30.8%
26-aug-2010 8274-8-9.8% 306283-23-7.5%
27-aug-2010 687468.8% 222523214.5%
28-aug-2010 5039-11-22.0% 209153-56-26.8%
29-aug-2010 5341-12-22.6% 190150-40-21.1%
30-aug-2010 9277-15-16.3% 306283-23-7.5%
31-aug-2010 121105-16-13.2% 528470-58-11.0%
01-sept-2010 102101-1-1.0% 493454-39-7.9%
02-sept-2010 8377-6-7.2% 308333258.1%
03-sept-2010 8580-5-5.9% 298288-10-3.4%
04-sept-2010 5345-8-15.1% 218160-58-26.6%
05-sept-2010 6153-8-13.1% 20420621.0%
06-sept-2010 9082-8-8.9% 365337-28-7.7%
07-sept-2010 123101-22-17.9% 533479-54-10.1%
08-sept-2010 9892-6-6.1% 447428-19-4.3%
09-sept-2010 8670-16-18.6% 312249-63-20.2%
10-sept-2010 7468-6-8.1% 261252-9-3.4%
11-sept-2010 5749-8-14.0% 325267-58-17.8%
12-sept-2010 5046-4-8.0% 175185105.7%
13-sept-2010 8973-16-18.0% 352284-68-19.3%
14-sept-2010 10487-17-16.3% 458343-115-25.1%
15-sept-2010 10297-5-4.9% 484525418.5%
16-sept-2010 140118-22-15.7% 556486-70-12.6%
17-sept-2010 838856.0% 2953444916.6%
18-sept-2010 5241-11-21.2% 171144-27-15.8%
19-sept-2010 6639-27-40.9% 199107-92-46.2%
20-sept-2010 11011000.0% 39539830.8%
21-sept-2010 119103-16-13.4% 437390-47-10.8%
22-sept-2010 131115-16-12.2% 680649-31-4.6%
23-sept-2010 114103-11-9.6% 480425-55-11.5%
24-sept-2010 10396-7-6.8% 471445-26-5.5%
25-sept-2010 5346-7-13.2% 21121210.5%
26-sept-2010 6241-21-33.9% 240161-79-32.9%
27-sept-2010 9975-24-24.2% 406284-122-30.0%
28-sept-2010 9910344.0% 3874698221.2%
29-sept-2010 11199-12-10.8% 460389-71-15.4%
30-sept-2010 11189-22-19.8% 425410-15-3.5%
total 43433838-505-11.6% 1756216073-1489-8.5%

The results are stunning:

  • The asynchronous tracking code has improved measuring performance for bounced visits: almost 12% more visits measured compared to the synchronous tracking code.
  • The asynchronous tracking code's results are worse for multiple page visits: 8,5% less pageviews are measured compared to the synchronous tracking code.

conclusions

The results of these tests lead us to conclude that a website might benefit from the asynchronous tracking code only if it has a high bounce rate. Then again we must consider the merits of measuring more bounced visits: we receive more accurate data on the visitors who click away early, at the same time we lose about 20% data on our other visitors, while the latter category is by far the more interesting group of visits to analyze.

So how is this possible? Why does the async code measure 8,5% less pageviews? For the moment we are assuming (and of course investigating) that there might be a difference in the way the browser handles the async versus the sync script code, causing these differences. You will hear from us again when we have more results to back these assumptions...