trackEcommerceTransaction

❗️

Deprecated

This method is no longer recommended. Use the trackEcommerceAddToCart() method instead.

The trackEcommerceTransaction() method tracks a confirmed order.

Syntax

await FlutterPiwikPro.sharedInstance.trackEcommerceTransaction(
    identifier: "orderID",
    grandTotal: orderGrandTotal,
    subTotal: orderSubTotal,
    tax: orderTax,
    shippingCost: orderShipping,
    discount: orderDiscount,
    transactionItems: ecommerceTransactionItems,
);

Parameters

orderID (string, required)

The unique order ID.

orderGrandTotal (number, required)

Total payment for the order. Includes tax, shipping and discounts. Format: 1/100 of the base currency unit. Example: 100 is 1 USD.

orderSubTotal (number, optional)

Payment for the order without shipping. Format: 1/100 of the base currency unit. Example: 100 is 1 USD.

orderTax (number, optional)

Tax included in the order. Format: 1/100 of the base currency unit. Example: 100 is 1 USD.

orderShipping (number, optional)

Shipping costs for the order. Format: 1/100 of the base currency unit. Example: 100 is 1 USD.

orderDiscount (number, optional)

Discounts included in the order. Format: 1/100 of the base currency unit. Example: 100 is 1 USD.

Examples

To track a confirmed order:

final ecommerceTransactionItems = [
EcommerceTransactionItem(category: 'cat1', sku: 'sku1', name: 'name1', price: 20, quantity: 1),
EcommerceTransactionItem(category: 'cat2', sku: 'sku2', name: 'name2', price: 10, quantity: 1),
EcommerceTransactionItem(category: 'cat3', sku: 'sku3', name: 'name3', price: 30, quantity: 2),
];
await FlutterPiwikPro.sharedInstance.trackEcommerceTransaction(
    identifier: "123ABC",
    grandTotal: 100,
    subTotal: 10,
    tax: 5,
    shippingCost: 100,
    discount: 6,
    transactionItems: ecommerceTransactionItems,
);