/ Published in: jQuery
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$('a:not(.no-tracking)').each(function(){ var link = this; if (link.hostname && link.hostname !== location.hostname){ $(link).bind('click keypress', function(event){ var code = event.charCode || event.keyCode; if (!code || (code && code == 13)){ _gaq.push(['_trackEvent', 'Outbound Links', this.href, this.title]); }; }); }; });