无论我做什么,我都会收到点击跟踪 Google Analytics(分析)代码的“未捕获的类型错误:未定义不是函数”错误。
页面是:http://www.purevisionmethod.com/eye-exercises/
请问,为什么会发生这种情况......?
<script>
$('#clicked-headerbar').on('click', function() {
ga('send', 'event', 'website-banner', 'clicked-ad', 'headerbar', '0');
});
$('#clicked-cta-bottom').click( function() {
ga('send', 'event', 'website-banner', 'clicked-ad', 'cta-bottom', '0');
});
$('#clicked-sidebar-image-ad-1').click( function() {
ga('send', 'event', 'website-banner', 'clicked-ad', 'sidebar-ad-1', '0');
});
$('#clicked-sidebar-image-ad-2').click( function() {
ga('send', 'event', 'website-banner', 'clicked-ad', 'sidebar-ad-2', '0');
});
$('#clicked-sidebar-image-ad-3').click( function() {
ga('send', 'event', 'website-banner', 'clicked-ad', 'sidebar-ad-3', '0');
});
</script>
感谢您的帮助!!
最佳答案
该错误与 Google Analytics(分析)无关。
该错误是因为您在使用 jQuery 的代码之后包含了 jQuery 库。将此代码移至 jQuery 包含下方,或将 jQuery 包含移至此代码之前,它将起作用。
关于javascript - Google Analytics 代码返回 'Undefined Function"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26540792/