sendTransaction

❗️

Deprecated

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

The sendTransaction() method tracks a confirmed order.

Syntax

[[PiwikTracker sharedInstance] sendTransaction:[PiwikTransaction transactionWithBlock:^(PiwikTransactionBuilder *builder) {
    builder.identifier = @"orderID";
    builder.grandTotal = @(orderGrandTotal);
    builder.subTotal = @(orderSubTotal);
    builder.tax = @(orderTax);
    builder.shippingCost = @(orderShipping);
    builder.discount = @(orderDiscount);
}]];

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:

[[PiwikTracker sharedInstance] sendTransaction:[PiwikTransaction transactionWithBlock:^(PiwikTransactionBuilder *builder) {
    builder.identifier = @"43967392";
    builder.grandTotal = @525000;
    builder.subTotal = @520000;
    builder.tax = @97000;
    builder.shippingCost = @15000;
    builder.discount = @10000;
    
    [builder addItemWithSku:@"584340"
                       name:@"Specialized Stumpjumper"
                   category:@"Mountain bike"
                      price:@500000
                   quantity:@1];
    
    [builder addItemWithSku:@"460923"
                       name:@"Specialized Chamonix"
                   category:@"Helmets"
                      price:@20000
                   quantity:@1];
}]];

Related methods