Skip to content

Instantly share code, notes, and snippets.

@richardh-vccp
Last active August 29, 2015 13:57
Show Gist options
  • Save richardh-vccp/9780950 to your computer and use it in GitHub Desktop.
Save richardh-vccp/9780950 to your computer and use it in GitHub Desktop.
module.exports = {
DATA_ATTR: 'data-tracker',
init: function() {
var _this = this;
_this.bind();
},
bind: function() {
var _this = this;
$('[' + this.DATA_ATTR + ']').on('click', function() {
var td = $(this).attr(_this.DATA_ATTR).split('|');
_this.ga(td[0], td[1], td[2]);
});
},
ga: function(category, action, label) {
var _this = this;
_gaq.push(['_trackEvent', category, action, label]);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment