Shoora
3/27/2012 - 10:30 PM

GA + jQuery async loader

GA + jQuery async loader

<!--
  Google Analytic's async loader modified to be even more async
  using jQuery
  http://code.google.com/apis/analytics/docs/tracking/asyncTracking.html
  -->

<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-xxxxx-x']);
_gaq.push(['_trackPageview']);

$(window).load(function() {
  var ga_src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  $.ajax({ cache: true, dataType: "script", url: ga_src });
});
</script>