如果你的網站是直接安裝GA4追蹤碼,而不是透過GTM部署,那麼所有電子商務事件都需要由工程師透過程式直接發送到GA4。
GA4電商事件流程圖
商品列表追蹤
商品列表通常出現在:
- 分類頁
- 搜尋結果頁
- 推薦商品區塊
- 熱門商品區塊
view_item_list(商品曝光)
當商品出現在頁面時觸發。
gtag('event', 'view_item_list', {
items: [{
item_id: 'SKU_12345',
item_name: 'jeggings',
coupon: 'SUMMER_FUN',
discount: 2.22,
index: 5,
item_list_name: 'Related Products',
item_list_id: 'related_products',
affiliation: 'Google Store',
item_brand: 'Gucci',
item_category: 'pants',
item_variant: 'black',
price: 9.99,
currency: 'USD',
quantity: 1
}],
item_list_name: 'Related products',
item_list_id: 'related_products'
});
注意:item_list_name 或 item_list_id 的值必須保持穩定。對于給定列表,這些值應始終相同。
select_item(點擊商品)
當使用者點擊商品卡片進入商品頁時觸發。
gtag('event', 'select_item', {
items: [{
item_id: 'SKU_12345',
item_name: 'jeggings',
coupon: 'SUMMER_FUN',
discount: 2.22,
index: 5,
item_list_name: 'Related Products',
item_list_id: 'related_products',
affiliation: 'Google Store',
item_brand: 'Gucci',
item_category: 'pants',
item_variant: 'black',
price: 9.99,
currency: 'USD',
quantity: 1
}],
item_list_name: 'Related products',
item_list_id: 'related_products'
});
view_item(瀏覽商品)
當使用者進入商品詳情頁時觸發。
gtag('event', 'view_item', {
currency: 'USD',
items: [{
item_id: 'SKU_12345',
item_name: 'jeggings',
coupon: 'SUMMER_FUN',
discount: 2.22,
affiliation: 'Google Store',
item_brand: 'Gucci',
item_category: 'pants',
item_variant: 'black',
price: 9.99,
currency: 'USD',
quantity: 1
}],
value: 9.99
});
促銷活動追蹤
如果首頁Banner、輪播圖、活動專區有促銷內容,建議實作以下事件。
view_promotion:展示促銷產品
促銷內容曝光。
gtag('event', 'view_promotion', {
items: [{
item_id: 'SKU_12345',
item_name: 'jeggings',
coupon: 'SUMMER_FUN',
discount: 2.22,
promotion_id: 'P_12345',
promotion_name: 'Summer Sale',
creative_slot: 'featured_app_1',
location_id: 'L_12345',
affiliation: 'Google Store',
item_brand: 'Gucci',
item_category: 'pants',
item_variant: 'Black',
price: 9.99,
currency: 'USD',
quantity: 1
}],
location_id: 'L_12345'
});
select_promotion:點擊促銷產品
促銷內容被點擊。
gtag('event', 'select_promotion', {
items: [{
item_id: 'SKU_12345',
item_name: 'jeggings',
coupon: 'SUMMER_FUN',
discount: 2.22,
promotion_id: 'P_12345',
promotion_name: 'Summer Sale',
creative_name: 'Summer Banner',
creative_slot: 'featured_app_1',
location_id: 'L_12345',
affiliation: 'Google Store',
item_brand: 'Gucci',
item_category: 'pants',
item_variant: 'Black',
price: 9.99,
currency: 'USD',
quantity: 1
}],
location_id: 'L_12345'
});
購物車追蹤
add_to_cart(加入購物車)
使用者加入商品時觸發。
gtag('event', 'add_to_cart', {
currency: 'USD',
items: [{
item_id: 'SKU_12345',
item_name: 'jeggings',
coupon: 'SUMMER_FUN',
discount: 2.22,
affiliation: 'Google Store',
item_brand: 'Gucci',
item_category: 'pants',
item_variant: 'black',
price: 9.99,
currency: 'USD',
quantity: 1
}],
value: 7.77
});
remove_from_cart(移除購物車)
商品被刪除時觸發。
gtag('event', 'remove_from_cart', {
currency: 'USD',
items: [{
item_id: 'SKU_12345',
item_name: 'jeggings',
coupon: 'SUMMER_FUN',
discount: 2.22,
affiliation: 'Google Store',
item_brand: 'Gucci',
item_category: 'pants',
item_variant: 'black',
price: 9.99,
currency: 'USD',
quantity: 1
}],
value: 7.77
});
結帳流程追蹤
currency和value是必须字段,購買成功和退款中transaction_
begin_checkout:開始結算
使用者開始結帳。
gtag('event', 'begin_checkout', {
coupon: 'SUMMER_FUN',
currency: 'USD',
items: [{
item_id: 'SKU_12345',
item_name: 'jeggings',
coupon: 'SUMMER_FUN',
discount: 2.22,
affiliation: 'Google Store',
item_brand: 'Gucci',
item_category: 'pants',
item_variant: 'black',
price: 9.99,
currency: 'USD',
quantity: 1
}],
value: 7.77
});
add_payment_info:添加支付信息
選擇付款方式。
gtag('event', 'add_payment_info', {
coupon: 'SUMMER_FUN',
currency: 'USD',
items: [{
item_id: 'SKU_12345',
item_name: 'jeggings',
coupon: 'SUMMER_FUN',
discount: 2.22,
affiliation: 'Google Store',
item_brand: 'Gucci',
item_category: 'pants',
item_variant: 'black',
price: 9.99,
currency: 'USD',
quantity: 1
}],
payment_type: 'Credit Card',
value: 9.99
});
add_shipping_info:添加地址信息
選擇配送方式。
gtag('event', 'add_shipping_info', {
coupon: 'SUMMER_FUN',
currency: 'USD',
items: [{
item_id: 'SKU_12345',
item_name: 'jeggings',
coupon: 'SUMMER_FUN',
discount: 2.22,
affiliation: 'Google Store',
item_brand: 'Gucci',
item_category: 'pants',
item_variant: 'Black',
price: 9.99,
currency: 'USD',
quantity: 1
}],
shipping_tier: 'Ground',
value: 7.77
});
purchase:購買成功
gtag('event', 'purchase', {
affiliation: 'Google Store',
coupon: 'SUMMER_FUN',
currency: 'USD',
items: [{
item_id: 'SKU_12345',
item_name: 'jeggings',
coupon: 'SUMMER_FUN',
discount: 2.22,
affiliation: 'Google Store',
item_brand: 'Gucci',
item_category: 'pants',
item_variant: 'black',
price: 9.99,
currency: 'USD',
quantity: 1
}, {
item_id: 'SKU_12346',
item_name: 'jeggings',
coupon: 'SUMMER_FUN',
discount: 2.22,
affiliation: 'Google Store',
item_brand: 'Gucci',
item_category: 'pants',
item_variant: 'gray',
price: 9.99,
currency: 'USD',
quantity: 1
}],
transaction_id: 'T_12345',
shipping: 3.33,
value: 21.09,
tax: 2.22
})
refund:退款
退款分為全額退款和部分退款
全额退款
gtag('event', 'refund', {
affiliation: 'Google Store',
coupon: 'SUMMER_FUN',
currency: 'USD',
transaction_id: 'T_12345',
shipping: 3.33,
value: 12.21,
tax: 1.11
});
部分退款
gtag('event', 'refund', {
affiliation: 'Google Store',
coupon: 'SUMMER_FUN',
currency: 'USD',
items: [{
item_id: 'SKU_12345',
item_name: 'jeggings',
coupon: 'SUMMER_FUN',
discount: 2.22,
affiliation: 'Google Store',
item_brand: 'Gucci',
item_category: 'pants',
item_variant: 'black',
price: 9.99,
currency: 'USD',
quantity: 1
}],
transaction_id: 'T_12345',
shipping: 3.33,
value: 12.21,
tax: 1.11
});
如何驗證GA4電商事件是否成功發送?
部署完整後,在 DebugView裡驗證事件是否出現,事件參數是否準確。
常見問題(FAQ)
為什麼purchase有觸發但沒有營收?
常見原因:
- value未傳送
- currency未傳送
- items 陣列為空
- transaction_id 重複
一定要實作全部事件嗎?
不用。
如果剛開始導入 GA4 電商追蹤,建議優先完成:view_item、add_to_cart、begin_check、purchase,這四個事件即可建立完整的購買漏斗分析。
總結
GA4的電商追蹤不一定需要GTM,也可以直接透過gtag.js完成部署。
