onclick
在通过条件检查是否存在cookie后,我想跟踪网站页面上的按钮。
非常简单,但哪种语法效果最好?
我研究了GA 事件跟踪语法的ga
andgaq_push
前缀和(如果我错了,请原谅我)但它们看起来很相似?
_gaq.push
<script type="text/javascript">
jQuery(document).ready(function () {
if (jQuery.cookie('entry_winagrand_cookie') !== null) {
jQuery('notregisterbtn').on('click', function () {
_gaq.push(['_trackEvent', 'QR_Win_A_Grand', 'Clicked through to Register']);
});
}
});
</script>
ga
<script type="text/javascript">
jQuery(document).ready(function () {
if (jQuery.cookie('entry_winagrand_cookie') !== null) {
jQuery('notregisterbtn').on('click', function () {
ga('send', 'event', 'button', 'click', 'QR_Win_A_Grand', 'Clicked_through_to_register');
});
}
});
</script>