ecommerceCartUpdate
The ecommerceCartUpdate() method tracks the current state of the cart.
Syntax
ecommerceCartUpdate(products, grandTotal)ecommerceCartUpdate(products, grandTotal)Parameters
products (Array<object>, required)
Product list. Each product should have the following attributes:
sku (string, required)
Product stock-keeping unit.
name (string, optional)
Product name (default: “”).
category (string|Array<string>, optional)
Product category or an array of up to 5 categories. Default: “”.
price (number|string, optional)
Product price has to be a float number or a string containing float number representation. Default: 0.
quantity (number|string, optional)
Product quantity has to be an integer number or a string containing integer representation. Default: 1.
brand (string, optional)
Product brand. Default: “”.
variant (string, optional)
Product variant. Default: “”.
customDimensions (object, optional)
Product custom dimensions. Default: {}.
grandTotal (number|string, required)
The total value of items in a cart has to be a float number or a string containing float number representation.
Examples
val products = EcommerceProducts()
val customDimensions = HashMap<Int, String>()
customDimensions[1] = "coupon-2020"
customDimensions[2] = "20%"
products.addProduct(EcommerceProducts.Product("craft-311")
.name("Unicorn Iron on Patch")
.category(arrayOf("Crafts & Sewing", "Toys"))
.price("49.90")
.quantity(3)
.brand("DMZ")
.variant("blue")
.customDimensions(customDimensions))
TrackHelper.track().ecommerceCartUpdate(products, "60000.78").with(tracker)EcommerceProducts products = new EcommerceProducts();
HashMap<Integer, String> customDimensions = new HashMap<Integer, String>();
customDimensions.put(1, "coupon-2020");
customDimensions.put(2, "20%");
products.addProduct(new EcommerceProducts.Product("craft-311")
.name("Unicorn Iron on Patch")
.category(new String[]{"Crafts & Sewing", "Toys"})
.price("49.90")
.quantity(3)
.brand("DMZ")
.variant("blue")
.customDimensions(customDimensions));
TrackHelper.track().ecommerceCartUpdate(products, "60000.78").with(tracker);Related methods
Updated 3 days ago