简体   繁体   English

Google Analytics 的 Onclick 按钮事件跟踪

[英]Onclick Button Event Tracking for Google Analytics

I want to track when a button has been clicked on.我想跟踪单击按钮的时间。 I have tried multiple ways of doing this and nothing shows up in my Google Analytics.我尝试了多种方法,但我的 Google Analytics(分析)中没有显示任何内容。 What am I doing wrong?我究竟做错了什么?

<a href="#Reserve" class="btn-large btn-primary text-white" onClick="ga([ '_trackEvent', 'button', 'click', 'reserve now' ]);" >RESERVE NOW<span class="glyphicon glyphicon-menu-right pull-right"></span></a>

Try this:尝试这个:

<a onclick="ga('send', 'event', 'type_here_your_category_event', 'type_here_your_event_name');" href="#">Hit here</a>

For buttons it's work as well.对于按钮,它也可以工作。

<button onclick="ga('send', 'event', 'type_here_your_category_event', 'type_here_your_event_name');">Hit here</button>

type_here_your_category_event - just type here your cat name type_here_your_event_name - detail name of event, send & event - live as is. type_here_your_category_event - 只需在此处输入您的猫名type_here_your_event_name - 事件、 sendevent的详细名称 - 保持原样。

It depends on which button you want to hook this event.这取决于您要挂钩此事件的按钮。

Please see Event Tracking from Google Analytics Docs请参阅 Google Analytics 文档中的事件跟踪

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM