Skip to content

Instantly share code, notes, and snippets.

@masiorama
Created March 9, 2013 23:11
Show Gist options
  • Save masiorama/5126205 to your computer and use it in GitHub Desktop.
Save masiorama/5126205 to your computer and use it in GitHub Desktop.
Js: track event wrapper for google analytics
// Add in Google Analytics tracking; just in case ga.js isn't correctly loaded
var track = function(category, name, value) {
if (window._gaq) {
window._gaq.push(["_trackEvent", category, name, value]);
}
};
track("Source", "Visit", this.href);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment