2011-04-29 3 views
6
나는 아약스 내 웹 사이트 URL 링크를 과부하 다음과 같은 기능을 사용하고

:JQuery와 살고 + Disqus에/Google 웹 로그 분석

$(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(); 
      }); 
    }); 
}); 

는 Google 웹 로그 분석 추적 및 Disqus에가에로드 통합 할 수 있다면 내가 알고 싶습니다 함수. 이것은 내가 Disqus에로드하려고 노력 코드이지만 몇 가지 이유에 대한 또 다른 웹 사이트에서 의견로드 다음을 배치, 당신은 단지 이벤트 호출에 직접 Google 웹 로그 분석 기능을 넣을 수 있습니다

답변

3

window.disqus_no_style = true; 
$.getScript("http://disqus.com/forums/mnml/embed.js") 

감사합니다 두 번째 매개 변수의 새 가상 URL

$(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 각 호출에 대해 고정 될 값 3 (현재 4) 별도의 jQuery 객체를 회전하기 위해 비효율적 이후, 이벤트 내에서 href를 캐시하는 기능을 수정했습니다.)

관련 문제