分析自定义变量
我正在尝试制作一份自定义报告。 我刚刚在我的主页上放置了一些测试代码:
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-12323748-3']);
_gaq.push(['_trackPageview']);
_gaq.push(['_setCustomVar',
2, // This custom var is set to slot #1
'Test_var', // The name acts as a kind of category for the user activity
'Yes', // This value of the custom variable
2 // Sets the scope to session-level
]);
(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>
我的自定义报告设置如下所示: http://updo.nl/file/ed351e11.png
但是,它只是显示为空(在检查报告之前我让它收集数据 2 天)
任何帮助将不胜感激
I'm trying to make a custom report.
I've just put some test code on my main page:
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-12323748-3']);
_gaq.push(['_trackPageview']);
_gaq.push(['_setCustomVar',
2, // This custom var is set to slot #1
'Test_var', // The name acts as a kind of category for the user activity
'Yes', // This value of the custom variable
2 // Sets the scope to session-level
]);
(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>
My custom report setup looks like this:
http://updo.nl/file/ed351e11.png
However, it just comes up as empty (I let it gather data for 2 days before checking the report)
Any help would be appreciated
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我问过很多同样的问题。有人告诉我,您必须将 setCustomVar 行放在 trackPageView 行上方和 var _gaq 行下方。像这样:
_trackPageview 将所有信息发送到 Google Analytics,因此您无法在发送后添加信息。
I've asked much the same question. I've been told that you have to put the setCustomVar line above the trackPageView line and below the var _gaq line. Like this:
_trackPageview sends all of the information to Google Analytics, so you can't add information after its already sent.