Created
March 11, 2015 13:58
-
-
Save vitorjustin/b526e508db8244e0a432 to your computer and use it in GitHub Desktop.
GA (Universal) event tracking
This file contains hidden or 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
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