Wring the most performance from the Google Analytics script

From an excellent post by Mathias Bynens… originally posted in 2010 but updated in June 2012.

http://mathiasbynens.be/notes/async-analytics-snippet

<script>
  var _gaq = [['_setAccount', 'UA-XXXXX-X'], ['_trackPageview']];
  (function(d, t) {
    var g = d.createElement(t),
        s = d.getElementsByTagName(t)[0];
    g.src = '//www.google-analytics.com/ga.js';
    s.parentNode.insertBefore(g, s);
  }(document, 'script'));
</script>

 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.