Skip to content

Instantly share code, notes, and snippets.

@vitorjustin
Created March 11, 2015 13:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save vitorjustin/b526e508db8244e0a432 to your computer and use it in GitHub Desktop.
Save vitorjustin/b526e508db8244e0a432 to your computer and use it in GitHub Desktop.
GA (Universal) event tracking
var noop = function () {};
var trackEvent = function () {
var ga = window.ga,
toArray = Array.prototype.slice,
params = ['send', 'event'].concat(toArray.call(arguments));
if (typeof ga === 'undefined') {
/*console.log('trackEvent');
console.log(params);*/
return noop();
}
return ga.apply(null, params);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment