javascript - JQuery live + Disqus / Google Analytics -
i'm using following function overload website url links ajax:
$(document).ready(function() { $('.insite').live("click", function(ev) { if ( history.pushstate ) history.pushstate( {}, document.title, $(this).attr('href')); ev.preventdefault(); $('#content').fadeout().load($(this).attr('href')+' #content', function() { $(this).fadein(); }); }); });
i know if it's possible integrate google analytics tracking , disqus loading function. code have tried load disqus loads comments websites reasons:
window.disqus_no_style = true; $.getscript("http://disqus.com/forums/mnml/embed.js")
thanks
you can put google analytics function directly in event call, placing new virtual url in 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've edited function cache href
within event, since inefficient spin 3 (now 4) separate jquery objects value fixed each call. )
Comments
Post a Comment