Created
March 27, 2012 22:30
-
-
Save geraldcombs/2221016 to your computer and use it in GitHub Desktop.
GA + jQuery async loader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
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