在2个页面上使用Google Analytics分析事件跟踪

时间:2014-04-03 14:27:08

标签: google-analytics google-analytics-api event-tracking

我正在努力在网站上设置事件跟踪,用户访问index.php,在那里他完成了使用javascript构建的quizz,在回答每个问题之后我跟踪事件,例如:

_gaq.push(['eventTracker._trackEvent', "myCategory", question_number.toString()]);

用户完成quizz之后,他被重定向到另一个页面:result.php,我跟踪着陆事件:

_gaq.push(['eventTracker._trackEvent', 'myResult', myScore.toString()]);

问题在于,在分析中,我可以看到类别=" myCategory"但不是类别" myResult"。

的事件

这是代码(这部分存在于index.php和result.php中):

var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'UA-XXXXXXX-2']);
    _gaq.push(['_trackPageview']); //an account for tracking page views

    (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>
     //the account we attach events to
    _gaq.push(['eventTracker._setAccount', 'UA-XXXXXXX-3']); 
    //..... racking code as posted before

0 个答案:

没有答案
相关问题