ecommerceOrder

The ecommerceOrder() method tracks conversions, including products and payment details.

Syntax

[[PiwikTracker sharedInstance] ecommerceOrder:products
                                       orderId:@""
                                    grandTotal:@""
                                      subTotal:@""
                                           tax:@""
                                      shipping:@""
                                      discount:@""];

Parameters

products (array, 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, 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: {}.

paymentInformation (object, required)

Complete payment information for products in the cart. Expected attributes:

orderId (string, required)

Unique order identifier.

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.

subTotal (number|string, optional)

The total value of items in a cart without shipping has to be a float number or a string containing float number representation.

tax (number|string, optional)

The total tax amount has to be a float number or a string containing float number representation.

shipping (number|string, optional)

The total shipping cost has to be a float number or a string containing float number representation.

discount (number|string, optional)

The total discount has to be a float number or a string containing float number representation.

Examples

Product *product = [Product productWithSku:@"craft-311"
                                       name:@"Unicorn Iron on Patch"
                                   category:@[@"Crafts & Sewing", @"Toys"]
                                      price:@"49.90"
                                   quantity:@3
                                      brand:@"DMZ"
                                    variant:@"blue"
                           customDimensions:@{@"1": @"coupon-2020", @"2": @"20%"}];

EcommerceProducts *products = [[EcommerceProducts alloc] init];
[products addProduct:product];

[[PiwikTracker sharedInstance] ecommerceOrder:products
                                       orderId:@"order-3415"
                                    grandTotal:@"180.00"
                                      subTotal:@"120.00"
                                           tax:@"39.60"
                                      shipping:@"60.00"
                                      discount:@"18.00"];

Related methods