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)

The unique order identifier.

grandTotal (string, required)

The total value of items in the order. Use a string that contains a float number.

products (Array<EcommerceProduct>, required)

The product list. Each product should have these attributes:

sku (string, required)

The product stock keeping unit (SKU).

name (string, optional)

The product name. Default: "".

category (string|Array<string>, optional)

The product category or an array of up to 5 categories. Default: "".

price (number|string, optional)

The product price. Use a float number or a string that contains a float number. Default: 0.

quantity (number|string, optional)

The product quantity. Use an integer or a string that contains an integer. Default: 1.

brand (string, optional)

The product brand. Default: "".

variant (string, optional)

The product variant. Default: "".

customDimensions (object, optional)

The product custom dimensions. Default: {}.

subTotal (string, optional)

The total value of items in the order without shipping. Use a string that contains a float number.

tax (string, optional)

The total tax amount. Use a string that contains a float number.

shippingCost (string, optional)

The total shipping cost. Use a string that contains a float number.

discount (string, optional)

The total discount. Use a string that contains a float number.

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