这是我正在使用的脚本,直接从 Google 复制:
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-CODE']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
function recordOutboundLink(link, category, action) {
try {
var myTracker=_gat._getTrackerByName();
_gaq.push(['myTracker._trackEvent', category , action ]);
setTimeout('document.location = "' + link.href + '"', 100);
}catch(err){}
}
</script>
这是我要跟踪的链接:
<a href="http://www.website.com/" target="_blank" class="ad" onClick="recordOutboundLink(this, 'Outbound Links', 'Visited website.com');return false;"></a>
然而,在过去的 3 天里,我的事件报告中没有显示任何内容。我的代码有问题吗?