Google Analytics _setCustomVar - 我的信息中心中的奇怪数据

时间:2011-03-04 08:37:22

标签: javascript variables google-analytics analytics

我为我的网站设置了_setCustomVar,如下所示:

<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-XXXXX']);
  _gaq.push(['_setDomainName', '.blog4ever.com']);
  _gaq.push(['_trackPageview']);
  _gaq.push(['_setCustomVar', 1, 'B4E_Type_Pub', 'Silver_ou_Gold', 3]);
  _gaq.push(['_setCustomVar', 2, 'B4E_Etat_Blog', 'normal', 3]);

  (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);
  })();

</script>

在我的信息中心,当我进入时:访客 - &gt;自定义变量,我看到我的2个变量,但数字真的很奇怪(就像40页的视图,虽然我有数千页的视图)。

我已经安装了2天了。

有人面临同样的问题吗?

1 个答案:

答案 0 :(得分:17)

你很幸运,即使有40个综合浏览量记录了这些变量。

您需要在_trackPageview之前调用_setCustomVar。否则,_trackPageview调用会将数据发送到Google Analytics,之后才会设置自定义变量。如果您在_setCustomVar之后设置_trackPageview,则自定义变量数据不会附加,如果在该网页浏览期间未设置其他__utm.gif次点击,则数据基本上会永久消失。

(记录的40个综合浏览量可能是通过网页加载后发送数据的其他页面GA调用进行跟踪的。)