This repository was archived by the owner on May 21, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 247
Ecommerce
Christian Brevik edited this page Aug 29, 2018
·
1 revision
A HitPayload can be sent with any tracking function, which supports ecommerce (among other things):
// Track with a payload (ecommerce in this case):
const product = {
id: "P12345",
name: "Android Warhol T-Shirt",
category: "Apparel/T-Shirts",
brand: "Google",
variant: "Black",
price: 29.2,
quantity: 1,
couponCode: "APPARELSALE"
};
const transaction = {
id: "T12345",
affiliation: "Google Store - Online",
revenue: 37.39,
tax: 2.85,
shipping: 5.34,
couponCode: "SUMMER2013"
};
const productAction = {
transaction,
action: 7 // Purchase action, see ProductActionEnum
}
const payload = { products: [ product ], productAction: productAction }
tracker.trackEvent("FinalizeOrderButton", "Click", null, payload);Other supported ecommerce specific payload properties are:
productsimpressionProductsimpressionListimpressionSourceproductAction
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:
tracker.trackScreenView("OrderReceipt", payload);Can we track Enhanced E commerce data from app using this flow?