2

此行可以在Google Analytics 自定义变量文档中找到

您最多可以同时使用 5 个自定义变量用于单个请求(例如网页浏览或事件调用)。在任何给定请求中,所有自定义变量的总和不能超过 5(即,您不能同时设置 5 个访问者和 5 个会话自定义变量)。

这是 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]);
4

1 回答 1

2

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

您最多可以同时使用 50 个自定义变量以在单个请求中使用(例如网页浏览或事件调用)。在任何给定请求中,所有自定义变量的总和不能超过 50(即,您不能同时设置 50 个访问者和 50 个会话自定义变量)。

正确的做法是第一种

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

于 2012-10-09T22:22:00.820 回答