gpt4 book ai didi

javascript - Analytics.js 是否可以在 ga ('set' ('send' ) 之后使用 ga ,'pageview' )?

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

我正在页面的头部运行谷歌分析。为了提高性能,我在正文末尾加载其他代码,例如 facebook 或 jQuery 业务逻辑异步延迟。

如果 ga('set', 'contentGroup1', 'Cat1') 或 ga('set', 'dimension1', 'customdimension1'); ,Google 通用分析是否正确跟踪在体内的任何地方被触发,而不是在 ga('send','pageview') 之前触发?

原理图示例:

<html>
<head>
...
ga('send','pageview')
...
</head>
<body>
ga('set', 'contentGroup1', 'Cat1')
</body>
</html>

最佳答案

documentation关于设置说:

The values that are set will persist with all the subsequent send calls for the lifetime of the tracker object.

因此,之前发送综合浏览量的调用不起作用(这是有道理的 - 每个文档发送“向 Google 的收集服务器发送跟踪信标”,并且以后的方法调用无法修改已发送的内容)。虽然分析代码是异步执行的(这可能就是您询问的原因),但跟踪调用仍然按照设置的顺序执行。

关于javascript - Analytics.js 是否可以在 ga ('set' ('send' ) 之后使用 ga ,'pageview' )?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24882313/

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