Google Analytics 有提供電子商務追蹤碼
藉由在網站程式中加入一些追蹤碼
可以讓網站的GA擁有分析網站訂單的平均金額成本,購買商品,和商品銷售統計等資料
主要界以下三個參數來將我們網站的訂單資訊提供GA
讓GA有這些資料得以分析
GATC Ecommerce Methods
- _addItem(transactionId, sku, name, category, price, quantity)
- _addTrans(transactionId, affiliation, total, tax, shipping, city, state, country)
- _trackTrans()
_addTrans:
是提供訂單資訊的方法包含以下參數範例如下
- transactionId 訂單編號
- affiliation : 聯絡人或商店名稱
- toal : 金額
- tax : 稅金
- shipping :運費
- city : 城市
- state : 洲
- country : 國家
_gaq.push(['_addTrans',
'1234', // transaction ID - required
'Womens Apparel', // affiliation or store name
'28.28', // total - required; Shown as "Revenue" in the
// Transactions report. Does not include Tax and Shipping.
'1.29', // tax
'15.00', // shipping
'San Jose', // city
'California', // state or province
'USA' // country
]);
_addItem:
是提供訂單購買商品的方法包含以下參數
- transactionId 訂單編號
- sku : 商品sku code
- name :商品名稱
- category : 商品分類
- price : 售價
- quantity : 數量
_gaq.push(['_addTrans',
'1234', // transaction ID - required
'Womens Apparel', // affiliation or store name
'28.28', // total - required; Shown as "Revenue" in the
// Transactions report. Does not include Tax and Shipping.
'1.29', // tax
'15.00', // shipping
'San Jose', // city
'California', // state or province
'USA' // country
]);
_trackTrans()
&將資料送出
_gaq.push(['_setAccount', 'UA-XXXXX-X']);
_gaq.push(['_trackPageview']);
_gaq.push(['_addTrans',
'1234', // transaction ID - required
'Womens Apparel', // affiliation or store name
'28.28', // total - required
'1.29', // tax
'15.00', // shipping
'San Jose', // city
'California', // state or province
'USA' // country
]);
_gaq.push(['_addItem',
'1234', // transaction ID - necessary to associate item with transaction
'DD44', // SKU/code - required
'T-Shirt', // product name
'Olive Medium', // category or variation
'11.99', // unit price - required
'1' // quantity - required
]);
_gaq.push(['_trackTrans']);
留言