Skip to content

Instantly share code, notes, and snippets.

@Shoora
Forked from geraldcombs/ga+jquery.html
Last active August 29, 2015 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Shoora/8232f60c755bab60351c to your computer and use it in GitHub Desktop.
Save Shoora/8232f60c755bab60351c to your computer and use it in GitHub Desktop.
Google Analytic's async loader modified to be even more async using jQuery
<!--
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment