gpt4 book ai didi

google-analytics - 将事件推送到多个配置文件

转载 作者:行者123 更新时间:2023-12-03 16:12:31 25 4
gpt4 key购买 nike

我们正在测试链接跟踪解决方案,目前希望事件显示在两个不同的帐户上。我们有这样的设置:

var _gaq = _gaq || [];
_gaq.push(
['_setAccount', 'UA-516606-1'],
['_trackPageview'],
['_setDomainName', 'du.edu'],
['b._setAccount', 'UA-516606-24'],
['b._trackPageview'],
['b._setDomainName', 'du.edu']
);
(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);
})();


我们使用的是位于 http://support.google.com/googleanalytics/bin/answer.py?hl=en&answer=55527处的跟踪代码,但是我没有专门的技巧来修改它以适用于多个帐户。因此,解决方案: Google analytics event tracking on Multiple accounts not working不能完全正常工作。是否可以将b帐户添加到recordOutboundLink函数?

最佳答案

您只需要使用其他recordOutboundLink函数。

function recordOutboundLink(link, category, action) {
_gaq.push(
['_trackEvent', category, action],
['b._trackEvent', category, action]
);
setTimeout('document.location = "' + link.href + '"', 100);
}


然后在您的链接上

<a href="http://www.example.com" onClick="recordOutboundLink(this, 'Outbound Links', 'example.com');return false;">

关于google-analytics - 将事件推送到多个配置文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11320664/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com