0

所以我在页面上有以下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);
})();

但是,如果我查看网络流量,我会看到一个对 a 的请求__utm.gif,但未utme设置参数,正如我所期望的那样。

4

1 回答 1

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.
   ]);
于 2012-10-03T13:44:55.537 回答