【发布时间】:2014-02-04 20:26:20
【问题描述】:
我在使用 google 分析时遇到了这个问题,我无法找到要显示在“行为”>“事件”>“热门事件”下的计数数据。
我正在使用经典分析。这是我的代码:
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-xxxxxxxx-1']);
_gaq.push(['_setDomainName', 'domain.com']);
_gaq.push(['_trackPageview']);
(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>
<script>
// custom events:
$(function() {
$('button').each(function(){
$(this).html($(this).data('event'));
});
$('button').click(function(){
var event = $(this).data('event');
_gaq.push(['_trackEvent', 'USER_INTERACTION', event, 'whatever babe']);
console.log(event);
});
});
</script>
<button type="button" data-event="CLICKS_BUTTON_1"></button><br />
<button type="button" data-event="CLICKS_BUTTON_2"></button><br />
<button type="button" data-event="CLICKS_BUTTON_3"></button><br />
<button type="button" data-event="CLICKS_BUTTON_4"></button><br />
<button type="button" data-event="CLICKS_BUTTON_5"></button><br />
<button type="button" data-event="CLICKS_BUTTON_6"></button><br />
<button type="button" data-event="CLICKS_BUTTON_7"></button><br />
<button type="button" data-event="CLICKS_BUTTON_8"></button><br />
<button type="button" data-event="CLICKS_BUTTON_9"></button><br />
<button type="button" data-event="CLICKS_BUTTON_10"></button><br />
<button type="button" data-event="CLICKS_BUTTON_11"></button><br />
<button type="button" data-event="CLICKS_BUTTON_12"></button><br />
<button type="button" data-event="CLICKS_BUTTON_13"></button><br />
<button type="button" data-event="CLICKS_BUTTON_14"></button><br />
<button type="button" data-event="CLICKS_BUTTON_15"></button><br />
但是,在实时部分下,出现了事件跟踪数据并且还可以。是否有任何其他必要的东西(代码)来实现以使其出现在行为>事件部分?
【问题讨论】:
-
对我来说它只在第二天出现......面临同样的问题
-
太棒了。谢谢阿伦。明天去看看。
-
它是否显示在实时报告中?
-
我同意阿伦的观点。由于“处理”(因为没有更好的术语),大多数数据最终需要 1 天才能显示出来。
标签: javascript jquery google-analytics tracking