Skip to content

Instantly share code, notes, and snippets.

@stugoo
Last active December 14, 2015 01:09
Show Gist options
  • Save stugoo/5003963 to your computer and use it in GitHub Desktop.
Save stugoo/5003963 to your computer and use it in GitHub Desktop.
Event tracking that also logs modernizr tests. - splits tests into passes & fails, with a variable to test if you want to track passes and/or fails
/* via @adamcbrewer */
track = function (args) {
args = args || {};
console.log(args);
var category = args.category,
action = args.action,
label = args.label;
if (_gaq) {
_gaq.push(['_trackEvent', category, action, label]);
}
};
/*usage */
track({
category: 'Deed',
action: 'Submit',
label: ''
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment