我成功跟踪我网站上的页面以向两个Google Analytics帐户报告,但是,我无法通过出站链接跟踪来跟踪Google Analytics帐户中的事件(这不是在任一方面跟踪)。任何想法为什么recordoutbound链接功能不工作?以下是我的代码:Google Analytics - 两个帐户的出站链接跟踪
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-1xxxxxx-x']);
_gaq.push(['_setDomainName', 'mysite.com']);
_gaq.push(['_setAllowLinker', true]);
_gaq.push(['_trackPageview']);
_gaq.push(['b._setAccount', 'UA-2xxxxxx-x']);
_gaq.push(['b._setDomainName', 'mysite.com']);
_gaq.push(['b._setAllowLinker', true]);
_gaq.push(['b._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 onePageTracker = _gat._getTracker("UA-1xxxxxx-x");
var twoPageTracker = _gat._getTracker("UA-2xxxxxx-x");
onePageTracker._trackEvent(category, action);
twoPageTracker._trackEvent(category, action);
setTimeout('document.location = "' + link.href + '"', 100)
} catch (err) { }
}
</script>