Last active
September 14, 2016 09:30
-
-
Save girvan/cbaee651cef73fbdb019 to your computer and use it in GitHub Desktop.
ga_link_event
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
function ga_link_event(e, params) | |
{ | |
var _this = this, | |
ga_params = ['send', 'event'].concat(params); | |
if(e.ctrlKey || e.metaKey || e.shiftKey) | |
ga.apply(_this, ga_params); | |
else | |
{ | |
var callback = function(){ | |
clearTimeout(timer); | |
location.href = $(e.currentTarget).attr('href'); | |
}; | |
var timer = setTimeout(callback, 3000); | |
e.preventDefault(); | |
ga_params.push({hitCallback:callback}); | |
ga.apply(_this, ga_params); | |
} | |
} | |
/* | |
$(".post").delegate('a.title, .read-more a', 'click', function(e){ | |
ga_link_event(e, ['index-page', 'click', $(this).attr('href')]); | |
}); | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment