Return to Snippet

Revision: 40881
at February 9, 2011 09:02 by JonasDoebertin


Initial Code
$('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]);
            };
        });
    };
});

Initial URL


Initial Description


Initial Title
Google Analytics: Tracking outbound links

Initial Tags


Initial Language
jQuery