2017-07-19 135 views
0

我想跟蹤按鈕被點擊的時間。我嘗試了多種方法來做到這一點,並且沒有任何內容顯示在我的Google Analytics中。我究竟做錯了什麼?谷歌分析的Onclick按鈕事件跟蹤

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

RESERVE NOW的[在谷歌分析跟蹤事件在點擊提交表單( –

+3

可能的複製https://stackoverflow.com/questions/4086587/track-event-in-google -analytics-upon-clicking-form-submit) – Dezza

回答

0

試試這個:

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

type_here_your_category_event - 只需輸入您在這裏貓的名字 type_here_your_event_name - 事件的詳細名稱, send & event - 住的是。

這取決於你想鉤住這個事件的按鈕。

請參閱Event Tracking從谷歌Analytics(分析)文檔

+0

有谷歌標籤刪除所有的「舊」事件跟蹤與此方法將其添加到鏈接? – HollerTrain