Skip to content

Instantly share code, notes, and snippets.

@lonekorean
Last active April 21, 2023 07:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lonekorean/47a3fe3925df79a14f67 to your computer and use it in GitHub Desktop.
Save lonekorean/47a3fe3925df79a14f67 to your computer and use it in GitHub Desktop.
Track outbound clicks
function trackOutboundClick(e) {
var $link = $(e.currentTarget);
var url = $link.attr('href');
ga('send', 'event', 'outbound', 'click', url, {
'hitCallback': function() {
document.location = url;
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment