Created
January 10, 2013 14:36
-
-
Save arvgta/4502479 to your computer and use it in GitHub Desktop.
New jQuery Plugin: Minimalist Google Analytics Inclusion
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
(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); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.