Howto track outgoing links with Google Analytics using jQuery

Simply include these lines and the jQuery library in your document.

$(document).ready(function() {
$('a[href^=http]:not("[href*=://' + document.domain + ']")').click(function() {
pageTracker._trackPageview('/out/'+$(this).attr("href"));
});
});

(please indent them!)

Cheers

May 29th, 2009 / Tech Talk / tim

Leave a Reply