Skip to content

Instantly share code, notes, and snippets.

@stevenwilkin
Created February 27, 2010 22:37
Show Gist options
  • Save stevenwilkin/317020 to your computer and use it in GitHub Desktop.
Save stevenwilkin/317020 to your computer and use it in GitHub Desktop.
/**
* initialise Google Analytics without having to slow down page load with adding script tags in layout
*/
function initAnalytics(){
var accountId = 'UA-XXXXXXX-X';
jQuery.getScript('http://www.google-analytics.com/ga.js', function(){
try {
var pageTracker = _gat._getTracker(accountId);
pageTracker._trackPageview();
} catch(err) {}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment