就创建跟踪而言,我已经完成了它的工作,就像这样:
$('a.external').click(function(){
_gaq.push(['_trackEvent', 'Exit Links', 'Click', $(this).attr('href')]);
});
<a href="http://example.com" class="external">example</a>
这通过以 href 作为标签正确地进行分析。我想要做的是能够标记他们所在的当前页面。因此,我们可以计算出当他们单击链接转到外部页面时他们在哪个页面上。
像这样的东西?
$('a.external').click(function(){
var pathName = window.location.pathname + document.location.hash;
alert(pathName);
_gaq.push(['_trackEvent', 'Exit Links', 'Click', $(this).attr('href')] pathName);
});
这会提醒正确的位置,但任何人都可以帮我清理它,以便将 pathName 添加到 gaq.push 中的标签中吗?
谢谢!
肖恩