这是 GA 输出代码:
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA_CODE']);
_gaq.push(['_setDomainName', 'SUBDOMAIN']);
_gaq.push(['_trackPageview']);
_gaq.push(['_trackEvent', 'Priority', 'Created (day)', 'Label info', '']);
(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>
trackEvent 行似乎是正确的...但由于某种原因没有跟踪。是因为我把 value 字段留成了 nil 吗?
最佳答案
对于_trackEvent
,value
参数应该是一个整数。由于它是可选参数,因此您可以将其省略:
_gaq.push(['_trackEvent', 'Priority', 'Created (day)', 'Label info']);
具有非整数值将阻止事件被跟踪。
关于google-analytics - Google Analytics 自定义事件未正确跟踪,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9299293/