目前有 260 位成員在線上
目前有 260 位成員在線上
關於GA基礎設定以及使用的疑難解答和分享,您可以學習如何評估廣告活動的成效,了解帳戶中各項統計數據的意義。
使用指南
star_border
回覆

Event Tracking onSubmit Code

[ 已編輯 ]
新手 ✭
# 1
新手 ✭

I'm trying to set up event tracking, but it doesn't work. The event counts zero on Google Analytics. I think there is something wrong with my code. Any ideas on what is wrong? Thank you.

 

Here is my code:

    

 <input id="submit_o2830002"         name="/atg/commerce/order/purchase/CartModifierFormHandler.checkout" value="goCheckOut" class="endbtn" type="submit" onsubmit="ga('send', {
                        &nbsp; hitType: 'event',
                        &nbsp; eventCategory: 'Order',
                        &nbsp; eventAction: 'goCheckOut',
                        &nbsp; eventLabel: 'click goCheckOut'
                        });">
1 專家回覆verified_user

回應: Event Tracking onSubmit Code

[ 已編輯 ]
解答王
# 2
解答王

Hi,

Try This

 

id="submit_o2830002"         name="/atg/commerce/order/purchase/CartModifierFormHandler.checkout" value="goCheckOut" class="endbtn" type="submit" onSubmit="ga('send', ‘event’, ‘Order’, ‘goCheckOut’, ‘click goCheckOut’);">

 

回應: Event Tracking onSubmit Code

新手 ✭
# 3
新手 ✭
Thank you for your advice! I found the problem. I should add the onsubmit event to my form tag, not to the submit button. Now I can track my event. Thank you all the same!