You can simply put the Google Analytics function directly into the call call by placing the new virtual URL in the second parameter.
$(document).ready(function() { $('.insite').live("click", function(ev) { var href = $(this).attr('href'); if ( history.pushState ) history.pushState( {}, document.title, href); ev.preventDefault(); $('#content').fadeOut().load(href+' #content', function() { $(this).fadeIn(); _gaq.push(['_trackPageview', href ]); }); }); });
(I edited the function for caching href inside the event, since its inefficiency is to rotate 3 (now 4) separate jQuery objects for a value that will be fixed for each call.)
Yahel source share