Transaction events (Sales Insights)

  • iOS
  • watchOS
  • tvOS


If you can’t see the “Sales Insights” menu entry in Explorer, please get in touch with us so we can activate this for you.


Transaction events

With the tracker, an ecommerce instance is available, exposing different objects and methods useful for measuring transaction confirmation.

Additionally, it’s possible to enable automatic tagging of SalesTracker orders by overriding the “autoSalesTracker” configuration variable:

let tracker: Tracker = ATInternet.sharedInstance.defaultTracker
tracker.ecommerce.setAutoSalesTrackerEnabled(true, sync: true, completionHandler: nil)
Tracker* tracker = [ATInternet sharedInstance].defaultTracker;
[tracker.ecommerce setAutoSalesTrackerEnabled:YES sync:YES completionHandler:nil];

The Sales Insights collection domain must be indicated via the “collectDomain” configuration variable:

tracker.ecommerce.setCollectDomain("collect-euw1", sync: true, completionHandler: nil)
[tracker.ecommerce setCollectDomain:@"collect-euw1" sync:YES completionHandler:nil];

See the full list of Ecommerce configuration variables that can be overridden at the end of this page.


Transaction confirmation

Measuring transaction confirmations is done by creating a TransactionConfirmation object, to which the following can be associated:

  • A list ofPromotionalCodes-type promo codes
  • An ECommerceCart-type cart
  • Client data in an ECommerceCustomer-type object
  • Shipping data in an ECommerceShipping-type object
  • Payment data in an ECommercePayment-type object
  • Transaction data in an ECommerceTransaction-type object
  • A list of products, products, which can contain one or several ECommerceProduct-type products.

A cart’s properties should be declared as a Dictionary-type collection, with different keys:

  • “id” – String: Cart ID.
  • “currency” – String: Currency.
  • “turnoverTaxIncluded” – Float: Total amount of cart, including tax (shipping costs included).
  • “turnoverTaxFree” – Float: Total amount of cart, excluding tax (shipping costs included).
  • “creation_utc” – Date: Date of creation of the cart (timestamp UTC in seconds).
  • “quantity” – Number: Total number of products in the cart.
  • “nbDistinctProduct” – Number: Number of distinct products in the cart.

A promotional code should be declared as a label/name.

The transaction ID should be declared in a property:

  • “id” – String: Transaction ID (mandatory).

Delivery data should be declared as a Dictionary-type collection, with different keys:

  • “delivery” – String: Name of shipping company.
  • “costTaxIncluded” – Float: Amount of shipping costs, including tax.
  • “costTaxFree” – Float: Amount of shipping costs, excluding tax.

Payment method should be declared in a property:

  • “mode” – String: Payment method.

Client data should be added in a property:

  • “new” – Boolean: New client (0 for no; 1 for yes).

A product’s properties should be declared in a Dictionary-type collection, with different keys:

  • “id” – String: Product ID (mandatory).
  • “variant” – String: Product variant (size, colour, etc.).
  • “name” – String: Product name.
  • “brand” – String: Product brand.
  • “discount” – Boolean: Discounted product (0 for no; 1 for yes).
  • “priceTaxIncluded” – Float: Price, including tax.
  • “priceTaxFree” – Float: Price, excluding tax.
  • “currency” – String: Currency.
  • “stock” – Boolean: Product in stock (0 for no; 1 for yes).
  • “quantity” – Number: Number of products in the cart.
  • “category1” – String: The product’s level 1 category (up to 6 tree structure levels are possible; from “category1” to “category6”).

If you use double tagging with SalesTracker, you will need to declare the confirmation page as a main goal.


let tracker: Tracker = ATInternet.sharedInstance.defaultTracker
let screen = tracker.screens.add("transaction")
let tc: TransactionConfirmation = tracker.ecommerce.transactionConfirmations.add(screen: screen)
_ = tc.cart.setAll(obj:
        "id": "34",
        "creation_utc": 1514973161, //UTC timestamp in seconds
        "turnoverTaxFree": 447.76, //Shipping fees included + discount 8€44
        "turnoverTaxIncluded": 547.4, //Shipping fees included + discount 10€
        "nbDistinctProduct": 1,
        "quantity": 1,
        "currency": "EUR"
_ = tc.promotionalCodes.append("DQQYRZSJ")
_ = tc.promotionalCodes.append("UN1ENE27")
_ = tc.transaction.set(key: "id", value: "27")
_ = tc.shipping.setAll(obj:
        "costTaxFree": 7,
        "costTaxIncluded": 8.4,
        "delivery": "My carrier"
_ = tc.payment.set(key: "mode", value: "Credit card")
_ = tc.customer.set(key: "new", value: 0)
_ = tc.products.append(ECommerceProduct(obj:
        "id": "1",
        "variant": "1",
        "name": "laptop_A56",
        "brand": "ACER",
        "discount": 1,
        "priceTaxIncluded": 549,
        "priceTaxFree": 456.2,
        "currency": "EUR",
        "stock": 1,
        "quantity": 1,
        "category1": "Computers_and_Networking",
        "category2": "Computers",
        "category3": "Laptops"
Tracker* tracker = [ATInternet sharedInstance].defaultTracker;
Screen *screen = [[tracker screens] add:@"transaction"];
TransactionConfirmation *tc = [[tracker.ecommerce transactionConfirmations] addWithScreen:screen];
NSMutableArray *tcproducts = [tc.products mutableCopy];
NSMutableArray *tcpromotionalcodes = [tc.promotionalCodes mutableCopy];
(void)[tc.cart setAllWithObj:@{
    @"id": @"34",
    @"creation_utc": @1514973161, //UTC timestamp in seconds
    @"turnoverTaxFree": @447.76, //Shipping fees included + discount 8€44
    @"turnoverTaxIncluded": @547.4, //Shipping fees included + discount 10€
    @"nbDistinctProduct": @1,
    @"quantity": @1,
    @"currency": @"EUR"
[tcpromotionalcodes addObject:@"DQQYRZSJ"];
[tcpromotionalcodes addObject:@"UN1ENE27"];
[tc setPromotionalCodes: tcpromotionalcodes];
(void)[tc.transaction setWithKey:@"id" value: @"EUR"];
(void)[tc.shipping setAllWithObj:@{
    @"costTaxFree": @7,
    @"costTaxIncluded": @8.4,
    @"delivery": @"My carrier"
(void)[tc.payment setWithKey:@"mode" value: @"Credit card"];
(void)[tc.customer setWithKey:@"new" value: @0];
[tcproducts addObject:[[ECommerceProduct alloc] initWithObj:@{
    @"id": @"1",
    @"variant": @"1",
    @"name": @"laptop_A56",
    @"brand": @"ACER",
    @"discount": @1,
    @"priceTaxIncluded": @549,
    @"priceTaxFree":@ 456.2,
    @"currency": @"EUR",
    @"stock": @1,
    @"quantity": @1,
    @"category1": @"Computers_and_Networking",
    @"category2": @"Computers",
    @"category3": @"Laptops"
[tc setProducts: tcproducts];
[tracker dispatch];

Declaring and adding a screen are necessary for SalesTracker order tagging.




Configuration variables

Name Default value Description Version
collectDomain “” Sales Insights collection domain  >= 2.12.0
autoSalesTracker false Enable automatic measurement of SalesTracker order content upon a transaction confirmation event  >= 2.12.0

Was this post helpful?

Last update: 07/05/2019