实施 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>
如果有人能够正确使用自定义变量来避免这个问题,如果您能指出解决方案,我将非常感激。
谢谢! 杰成
I'm having trouble implementing Google Analytics Custom Variables on my site. The problem is that the bounce rate goes to zero when using them.
I'm using the asynchronous implementation and the split code version (http://code.google.com/apis/analytics/docs/tracking/asyncUsageGuide.html#SplitSnippet) to track the pageview.
So, my code looks something like this:
<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>
If anyone has been able to properly use Custom Variables avoiding this issue, I would really appreciate if you can point to a solution.
Thanks!
JC
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不能对 Google 的异步代码使用自定义对象名称。将
_gaq_custom_variables
更改回_gaq
You cannot use a custom object name for google's async code. change
_gaq_custom_variables
back to_gaq