所以我在页面上有以下javascript:
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '<our account number>']);
_gaq.push('_setCustomVar',1,'page_type','main', 3);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
但是,如果我查看网络流量,我会看到__utm.gif
的一个请求,但未设置utme
参数,正如我预期的那样。
答案 0 :(得分:4)
您仍然需要方括号:(google custom vars)
_gaq.push(['_setCustomVar',
1, // This custom var is set to slot #1. Required parameter.
'Items Removed', // The name acts as a kind of category for the user activity. Required parameter.
'Yes', // This value of the custom variable. Required parameter.
2 // Sets the scope to session-level. Optional parameter.
]);