Skip to content

Instantly share code, notes, and snippets.

@arvgta
Created January 10, 2013 14:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arvgta/4502479 to your computer and use it in GitHub Desktop.
Save arvgta/4502479 to your computer and use it in GitHub Desktop.
New jQuery Plugin: Minimalist Google Analytics Inclusion
(function($){
$.GA=function(c){
$.ajax({
url: (document.location.protocol == "https:" ?
"https://ssl" : "http://www") + '.google-analytics.com/ga.js',
success: function() {
_gat._getTracker(c)._trackPageview();
},
dataType: 'script'
});
};
})(jQuery);
@arvgta
Copy link
Author

arvgta commented Jan 10, 2013

Please refer to http://4nf.org/more/ga/

...for an explanation on how to hotlink to this jQuery plugin via a simple getScript().

The aim is to provide the shortest possible, plain vanilla inclusion of Google Analytics for existing jQuery users, without adding a gram of HTML to the user's pages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment