我无法获得“订阅表单”事件跟踪来提交网站上的按钮按下。
相关代码是:-
按钮代码
type="submit" and value="Subscribe"
<script>
document.addEventListener( 'submit', function( event ) {ga('Subscribe', 'event', 'Subscription Form', 'submit');}, false );
</script>
最佳答案
您的代码是错误的,应将Subscribe
方法替换为send
来发送事件:
你有什么:
ga('Subscribe', 'event', 'Subscription Form', 'submit');
应该是什么:
ga('send', 'event', 'Subscription Form', 'submit');
而且,您可能需要利用
label
字段来提供更多信息,例如表单ID:var form_id = ...; // some custom code to fetch form id from submit event
ga('send', 'event', 'Subscription Form', 'submit', form_id);
有关更多信息,请参见文档:https://developers.google.com/analytics/devguides/collection/analyticsjs/events
关于events - 订阅表单(在Google Analytics(分析)中提交事件跟踪),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55513164/