Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/74.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 谷歌分析的Onclick按钮事件跟踪_Javascript_Html_Google Analytics - Fatal编程技术网

Javascript 谷歌分析的Onclick按钮事件跟踪

Javascript 谷歌分析的Onclick按钮事件跟踪,javascript,html,google-analytics,Javascript,Html,Google Analytics,我想跟踪按钮被点击的时间。我尝试了多种方法,但在我的谷歌分析中什么都没有出现。我做错了什么 <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"&

我想跟踪按钮被点击的时间。我尝试了多种方法,但在我的谷歌分析中什么都没有出现。我做错了什么

<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>

试试这个:

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

对于按钮,这也是一项工作

<button onclick="ga('send', 'event', 'type_here_your_category_event', 'type_here_your_event_name');">Hit here</button>
点击这里
在此处键入您的类别事件
-只需在此处键入您的猫名即可
在此处键入您的事件名称
-事件的详细名称,
发送
&
事件
-按原样直播

这取决于要挂接此事件的按钮


请参阅Google Analytics Docs

的可能副本Google标记是否已通过将其添加到链接的方法删除所有“旧”事件跟踪?