Skip to content

Instantly share code, notes, and snippets.

@rpominov
Last active August 29, 2015 14:04
Show Gist options
  • Save rpominov/294d1a33f09c5a7826bd to your computer and use it in GitHub Desktop.
Save rpominov/294d1a33f09c5a7826bd to your computer and use it in GitHub Desktop.
// old API
$('[data-track-click]').each(function(){
var $el = $(this);
var params = ['_trackEvent'].concat(
$el.data('track-click').split(',')
);
$el.click(function(){
_gaq.push(params);
});
});
// new API
$('[data-track-click]').each(function(){
var $el = $(this);
var params = ['send', 'event'].concat(
$el.data('track-click').split(',')
);
$el.click(function(){
ga.apply(null, params);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment