此行可在Google Analytics Custom Variable Documentation
中找到您最多可以同时使用5个自定义变量 请求(例如综合浏览量或事件调用)。所有自定义内容的总和 在任何给定的请求中,varaiables不能超过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]);
答案 0 :(得分:2)
是的,您最多可以将50个自定义变量附加到Google Analytics Premium。因此,应该阅读Google Analytics Premium客户的声明:
您最多可以同时使用50个自定义变量 请求(例如综合浏览量或事件调用)。所有自定义的总和 在任何给定的请求中,varaiables不能超过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]);
请注意,premium和free的javascript代码是相同的。因此,如果您尝试在Google Analytics免费版中执行此操作,它看起来会有效,但除非您拥有Google Analytics Premium Edition,否则处理后端会忽略5以上的额外变量。
有关Google Analytics Premium的更多信息