google-analytics - 我可以使用 Google Analytics Premium 将 "attach"5 个以上的自定义变量添加到同一个 _trackPageview 中吗?

标签 google-analytics

此行可以在 Google Analytics Custom Variable Documentation 中找到

You have up to 5 simultaneous custom variables for use in a single request (e.g. pageview or event call). The sum of all your custom varaiables cannot exceed 5 in any given request (i.e. you cannot have 5 visitor and 5 session custom variables set simultaneously).

这是否是 javascript/beacon 的限制和/或 GA 在免费版 Google Analytics(分析)中汇总事件的方式的限制?

用代码改写一下,如果我使用的是支付 GA Premium 的帐户,这会起作用吗?

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXX-X']);
_gaq.push(['_setCustomVar', 1, 'Foo', "Bar", 1]);
_gaq.push(['_setCustomVar', 2, 'Biz', "Baz", 2]);
_gaq.push(['_setCustomVar', 3, 'Ugg', "Bot", 3]);
_gaq.push(['_setCustomVar', 4, 'Big', "Bug", 1]);
_gaq.push(['_setCustomVar', 5, 'Sun', "Tin", 2]);
_gaq.push(['_setCustomVar', 6, 'Hor', "Ton", 3]);
_gaq.push(['_setCustomVar', 7, 'Saw', "Who", 1]);
_gaq.push(['_setCustomVar', 8, 'Dis', "Dat", 2]);
_gaq.push(['_setCustomVar', 9, 'Who', "Der", 3]);
_gaq.push(['_trackPageview']);
_gaq.push(["_trackEvent", "cat", "action", "lbl", 0, true]);

或者我必须像这样构造上面的代码:

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXX-X']);
_gaq.push(['_setCustomVar', 1, 'Foo', "Bar", 1]);
_gaq.push(['_setCustomVar', 2, 'Biz', "Baz", 2]);
_gaq.push(['_setCustomVar', 3, 'Ugg', "Bot", 3]);
_gaq.push(['_setCustomVar', 4, 'Big', "Bug", 1]);
_gaq.push(['_setCustomVar', 5, 'Sun', "Tin", 2]);
_gaq.push(['_trackPageview']);
_gaq.push(['_setCustomVar', 6, 'Hor', "Ton", 3]);
_gaq.push(['_setCustomVar', 7, 'Saw', "Who", 1]);
_gaq.push(['_setCustomVar', 8, 'Dis', "Dat", 2]);
_gaq.push(['_setCustomVar', 9, 'Who', "Der", 3]);
_gaq.push(["_trackEvent", "cat", "action", "lbl", 0, true]);

最佳答案

是的,您最多可以将 50 个自定义变量附加到 Google Analytics Premium。因此,针对 Google Analytics Premium 客户的声明应如下所示:

You have up to 50 simultaneous custom variables for use in a single request (e.g. pageview or event call). The sum of all your custom varaiables cannot exceed 50 in any given request (i.e. you cannot have 50 visitor and 50 session custom variables set simultaneously).

正确的做法是第一种

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXX-X']);
_gaq.push(['_setCustomVar', 1, 'Foo', "Bar", 1]);
_gaq.push(['_setCustomVar', 2, 'Biz', "Baz", 2]);
_gaq.push(['_setCustomVar', 3, 'Ugg', "Bot", 3]);
_gaq.push(['_setCustomVar', 4, 'Big', "Bug", 1]);
_gaq.push(['_setCustomVar', 5, 'Sun', "Tin", 2]);
_gaq.push(['_setCustomVar', 6, 'Hor', "Ton", 3]);
_gaq.push(['_setCustomVar', 7, 'Saw', "Who", 1]);
_gaq.push(['_setCustomVar', 8, 'Dis', "Dat", 2]);
_gaq.push(['_setCustomVar', 9, 'Who', "Der", 3]);
_gaq.push(['_trackPageview']);
_gaq.push(["_trackEvent", "cat", "action", "lbl", 0, true]);

请注意,付费版和免费版的 JavaScript 代码是相同的。因此,如果您尝试在 Google Analytics 免费版中执行此操作,它看起来会起作用,但处理后端将忽略 5 以上的额外变量,除非您有 Google Analytics 高级版。

有关 Google Analytics Premium 的更多信息

http://www.google.com/analytics/premium/features.html

关于google-analytics - 我可以使用 Google Analytics Premium 将 "attach"5 个以上的自定义变量添加到同一个 _trackPageview 中吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12806819/

相关文章:

python - 我是在父级和子级 Django 模板中添加 Google Analytics 跟踪脚本,还是仅在 Django 网站上的父级模板中添加 Google Analytics 跟踪脚本?

javascript - 在我的 javascript 文件中插入 Google 分析脚本

jquery - 如何使用 Google Analytics 跟踪 HTML5 浏览器功能 (modernizr)?

javascript - Google Analytics 测量协议(protocol)不安全?

google-analytics - 使用 Google Analytics 使用 embed api 为 Web 应用程序的客户显示数据子集

google-analytics - 我不能在 firebase 上查看实时用户吗?

mysql - Google Analytics 查询性能和历史数据

javascript - 切换谷歌分析 - 选择退出/选择加入

java - 如何实现新的 Google Play 服务(分析)?

joomla - 谷歌分析跟踪子域错误