trackEcommerceOrder
The trackEcommerceOrder() method tracks conversions, including products and payment details.
Syntax
await FlutterPiwikPro.sharedInstance.trackEcommerceOrder(
identifier: 'identifier',
grandTotal: 'grandTotal',
products: ecommerceProducts,
subTotal: 'subTotal',
tax: 'tax',
shippingCost: 'shippingCost',
discount: 'discount',
currencyCode: 'currencyCode',
);Parameters
identifier (string, required)
Unique order identifier.
grandTotal (string, required)
The total value of items in the order. A string containing a float number representation.
products (Array<EcommerceProduct>, 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: {}.
subTotal (string, optional)
The total value of items in the order without shipping. A string containing a float number representation.
tax (string, optional)
The total tax amount. A string containing a float number representation.
shippingCost (string, optional)
The total shipping cost. A string containing a float number representation.
discount (string, optional)
The total discount. A string containing a float number representation.
currencyCode (string, optional)
The ISO 4217 currency code for the order. Example: USD, EUR, PLN.
Examples
final ecommerceproducts = [
EcommerceProduct(sku: 'craft-311',
name: 'Unicorn Iron on Patch',
category: ['Crafts & Sewing', 'Toys'],
price: '49.9089',
quantity: 3,
brand: 'DMZ',
variant: 'blue',
customDimensions: {1: 'coupon-2020', 2: '20%'}),
EcommerceProduct(sku: 'dert-456')
];
await FlutterPiwikPro.sharedInstance.trackEcommerceOrder(
identifier: 'order-3415',
grandTotal: '10000',
subTotal: '120.00',
tax: '39.60',
shippingCost: '60.00',
discount: '18.00',
products: ecommerceProducts,
);Related methods
Updated 24 days ago