分析自定义变量

发布于 2024-09-27 15:01:31 字数 1012 浏览 6 评论 0原文

我正在尝试制作一份自定义报告。 我刚刚在我的主页上放置了一些测试代码:

<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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

倾城泪 2024-10-04 15:01:31

我问过很多同样的问题。有人告诉我,您必须将 setCustomVar 行放在 trackPageView 行上方和 var _gaq 行下方。像这样:

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-12323748-3']);
_gaq.push(['_setCustomVar', 2, 'Test_var', 'Yes', 2]);
_gaq.push(['_trackPageview']);

_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:

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-12323748-3']);
_gaq.push(['_setCustomVar', 2, 'Test_var', 'Yes', 2]);
_gaq.push(['_trackPageview']);

_trackPageview sends all of the information to Google Analytics, so you can't add information after its already sent.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文