You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Christian Brevik edited this page Aug 29, 2018
·
1 revision
Intro to Ecommerce
A HitPayload can be sent with any tracking function, which supports ecommerce (among other things):
// Track with a payload (ecommerce in this case):constproduct={id: "P12345",name: "Android Warhol T-Shirt",category: "Apparel/T-Shirts",brand: "Google",variant: "Black",price: 29.2,quantity: 1,couponCode: "APPARELSALE"};consttransaction={id: "T12345",affiliation: "Google Store - Online",revenue: 37.39,tax: 2.85,shipping: 5.34,couponCode: "SUMMER2013"};constproductAction={
transaction,action: 7// Purchase action, see ProductActionEnum}constpayload={products: [product],productAction: productAction}tracker.trackEvent("FinalizeOrderButton","Click",null,payload);
Other supported ecommerce specific payload properties are:
products
impressionProducts
impressionList
impressionSource
productAction
As seen above, if productAction is set, you should also include one or more products in the products property.
If you want to track product impressions, you should include one or more products in the impresssionProducts property, and also set impressionList & impressionSource.
As stated above, the payload can be sent with any tracking function. So you can also track ecommerce events with trackScreenView: