我正在尝试设置5个自定义变量用于Google Analytics,如下所示:
<script>
//<![CDATA[
var _gaq=[["_setAccount","UA-XXXXXXXXX-X"],["_trackPageLoadTime"]];
_gaq.push(['_setCustomVar', 1, 'categories', 'News', 3]);
_gaq.push(['_setCustomVar', 2, 'tags', 'something, another, passbook, iphone, ipod, ios6, insider, egift, more things, some other stuff', 3]);
_gaq.push(['_setCustomVar', 3, 'productcount', 0, 3]);
_gaq.push(['_setCustomVar', 4, 'isvideo', 'false', 3]);
_gaq.push(['_trackPageview']);
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];g.async=1;
g.src=("https:"==location.protocol?"//ssl":"//www")+".google-analytics.com/ga.js";
s.parentNode.insertBefore(g,s)}(document,"script"));
//]]>
</script>
我认为我遵循了所有规则,在调用trackPageView之前添加不超过5个自定义变量,但它们仍然没有在Google Analytics中显示。
_setCustomVar
的参数使用是正确的。 - Kristian'productcount'
上,CustomVar的值应该是一个字符串,但它似乎是一个数字。试试这个:_gaq.push(['_setCustomVar', 3, 'productcount', '0', 3]);
。但我不确定它是否会影响到其他好的CV。 - Eduardo