我正在尝试像这样在 jQuery 中设置分析事件
jQuery(document).ready(function() {
var time_to_open=15000;
if(readCookie('cookie')!='set'){
setTimeout(function() {
jQuery('#my_animation').animate({left: 0}, 1000);
createCookie('cookie', 'set', 1);
_gaq.push(['_trackEvent', 'animation', 'started', time_to_open]);
},time_to_open);
}
});
这应该跟踪动画显示的频率。但它不起作用。 _trackEvent 是否仅针对点击事件?或者我做错了什么?
最佳答案
如果 opt_label 参数不是字符串,
_trackEvent
可能会悄无声息地失败。将 time_to_open
转换为字符串,或将其作为 opt_value
参数传递。
_gaq.push(['_trackEvent', 'animation', 'started', undefined, time_to_open]);
关于javascript - 如何在没有点击事件的情况下在 jQuery 中设置分析事件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19201034/