Asynchronous Google Analytics snippets (v19)

Revision 19 of this benchmark created on


Description

Test case which measures the speed difference between the default asynchronous Google Analytics snippet and the optimized version.

Note that I commented out the s.parentNode.insertBefore(g, s); line in both scripts, since otherwise the <script> element gets inserted a few thousand times every time you run the tests. Since this code is the same in both scripts, it shouldn’t have an influence on the results.

Test runner

Ready to run.

Testing in
TestOps/sec
Default snippet
< script src = "http://www.google.com/adsense/search/ads.js"
type = "text/javascript" > < /script>
ready
Optimized snippet
(function(G, o, O, g, L, e) {
  G[g] = G[g] || function() {
    (G[g]['q'] = G[g]['q'] || []).push(
      arguments)
  }, G[g]['t'] = 1 * new Date;
  L = o.createElement(O), e = o.getElementsByTagName(
    O)[0];
  L.async = 1;
  L.src = '//www.google.com/adsense/search/async-ads.js';
  e.parentNode.insertBefore(L, e)
})(window, document, 'script', '_googCsa');
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.