2011-04-29 58 views
1

我在我的网站上实施Google Analytics自定义变量时遇到问题。问题在于使用它们时的跳出率为零。实施Google Analytics自定义变量的问题(跳出率趋于零)

我正在使用异步实现和拆分代码版本(http://code.google.com/apis/analytics/docs/tracking/asyncUsageGuide.html#SplitSnippet)来跟踪综合浏览量。 所以,我的代码看起来是这样的:

<script type="text/javascript"> 
    var _gaq_custom_variables = _gaq_custom_variables || []; 
    _gaq_custom_variables.push(['_setAccount', 'UA-22770314-1']); 
</script> 

<!-- rest of page content --> 

<script type="text/javascript"> 
    _gaq_custom_variables.push(['_setCustomVar', 
       1,   // Slot 
       'Variable Name',  // Variable name 
       'Value',  // Variable value 
       3     // Scope. 
    ]); 
</script> 

<script type="text/javascript"> 
    _gaq_custom_variables.push(['_trackPageview']); 

(function() { 
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; 
    ga.src = 'http://www.google-analytics.com/ga.js'; 
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); 
})(); 
</script> 

如果有人已经能够正常使用自定义变量避免这个问题,我会很感激,如果你可以指向一个解决方案。

谢谢! JC

回答

1

您不能为谷歌的异步代码使用自定义对象名称。将_gaq_custom_variables更改为_gaq

相关问题