Skip to content
This repository was archived by the owner on May 5, 2026. It is now read-only.

Orders fdaa23

Benjamin Diolez edited this page May 5, 2026 · 1 revision

Data collection / Apple / Ecommerce / Orders

Foreword

AT Internet�s SDK allows you to tag orders placed by your users while using your application.

Get off to a good start

Once your tag is initialised, you can add order information to your screen hit.

In the case of a Swift project, be sure to import the Tracker module in your ViewController. In the case of an Objective-C project, be sure to import the header SmartTracker-Swift.h

Tagging

The tracker makes an orders property available. This property exposes an add method allowing the inclusion of order information, and the addition of this information to your screen tagging.

This method sends back an Order-type object.

Tagging examples

  1. Tagging an order and a main goal screen
    Without the SalesTracker option

    Even without the SalesTracker option enabled, you can measure the order confirmation screen (main goal) and insert the order total (turnover) as well as the order number (orderId).

import UIKit
import Tracker

class ViewController: UIViewController {
    let tracker: Tracker = ATInternet.sharedInstance.defaultTracker
    
    override func viewDidLoad() {
        super.viewDidLoad()
    }
    
    override func viewWillAppear(_ animated: Bool) {
        let screen = tracker.screens.add("Main goal screen")
        screen.order = Order(orderId: "8235", turnover: 2049.30)
        screen.sendView()
    }
}
#import "ViewController.h"
#import "SmartTracker/SmartTracker-Swift.h"

@interface ViewController ()
@property (nonatomic, strong) Tracker* tracker;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.tracker = [ATInternet sharedInstance].defaultTracker;
}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    [self.tracker.orders add:@"8235" turnover:2049.30];
    [[self.tracker.screens add:@"Main goal screen"] sendView];
}

@end

With the SalesTracker option

import UIKit
import Tracker

class ViewController: UIViewController {
    let tracker: Tracker = ATInternet.sharedInstance.defaultTracker
    
    override func viewDidLoad() {
        super.viewDidLoad()
    }
    
    override func viewWillAppear(_ animated: Bool) {            
        let order = tracker.orders.add("cmd1", turnover: 94.30, status: 1)
        // First order from that customer
        order.isNewCustomer = true
        // Payment Method
        order.paymentMethod = 1
        // Order Status
        order.status = 1
        // Order amount
        order.amount.set(80, amountTaxIncluded: 94.30, taxAmount: 14)
        // Order delivery info
        order.delivery.set(5, shippingFeesTaxIncluded: 7.5, deliveryMethod: "1[UPS]")
        // Discount info
        order.discount.set(5, discountTaxIncluded: 7.5, promotionalCode: "SUMMER")
        
        let confirmOrderScreen = tracker.screens.add("Order confirmation")
        confirmOrderScreen.sendView()
    }
}
#import "ViewController.h"
#import "SmartTracker/SmartTracker-Swift.h"

@interface ViewController ()
@property (nonatomic, strong) Tracker* tracker;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.tracker = [ATInternet sharedInstance].defaultTracker;
}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
   
    Order* order = [self.tracker.orders add:@"cmd1" turnover: 94.30 status: 1];
    // First order from that custom
    order.isNewCustomer = YES;
    // Payment Method
    order.paymentMethod = 1;
    // Order Status
    order.status = 1;    
    // Order amount
    [order.amount set:80 amountTaxIncluded:94.30 taxAmount: 14];
    // Order delivery info
    [order.delivery set:5 shippingFeesTaxIncluded: 7.5 deliveryMethod: @"1[UPS]"];
    // Discount info
    [order.discount set:5 discountTaxIncluded: 7.5 promotionalCode: @"SUMMER"];
    
    Screen *confirmOrderScreen = [self.tracker.screens add:@"Order confirmation"];
    [confirmOrderScreen sendView];
}

@end
  1. Tagging an order with cart information
    For more information on tagging your cart, please visit this page: Cart (SalesTracker)

import UIKit
import Tracker

class ViewController: UIViewController {
    let tracker: Tracker = ATInternet.sharedInstance.defaultTracker
    
    override func viewDidLoad() {
        super.viewDidLoad()
    }
    
    override func viewWillAppear(_ animated: Bool) {
        tracker.cart.set("1")
        
        let p1 = tracker.cart.products.add("ID[p1]")
        p1.category1 = "10[Shoes]"
        p1.quantity = 1
        p1.unitPriceTaxFree = 70
        p1.unitPriceTaxIncluded = 85
        p1.promotionalCode = "ATInternet"
        p1.discountTaxFree = 0
        p1.discountTaxIncluded = 0
        
        let p2 = tracker.cart.products.add("ID[p2]")
        p2.category1 = "20[Socks]"
        p2.quantity = 2
        p2.unitPriceTaxFree = 5
        p2.unitPriceTaxIncluded = 7
        
        let order = tracker.orders.add("cmd1", turnover: 94.30, status: 1)
        // First order from that custom
        order.isNewCustomer = true
        // Payment Method
        order.paymentMethod = 1
        // Order Status
        order.status = 1
        // Order amount
        order.amount.set(80, amountTaxIncluded: 94.30, taxAmount: 14)
        // Order delivery info
        order.delivery.set(5, shippingFeesTaxIncluded: 7.5, deliveryMethod: "1[UPS]")
        // Discount info
        order.discount.set(5, discountTaxIncluded: 7.5, promotionalCode: "SUMMER")
        
        let confirmOrderScreen = tracker.screens.add("Order confirmation")
        confirmOrderScreen.sendView()
        
        tracker.cart.unset()
    }
}
#import "ViewController.h"
#import "SmartTracker/SmartTracker-Swift.h"

@interface ViewController ()
@property (nonatomic, strong) Tracker* tracker;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.tracker = [ATInternet sharedInstance].defaultTracker;
}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];

    [self.tracker.cart set:@"1"];
    
    Product *p1 = [self.tracker.cart.products addString:@"ID[p1]"];
    p1.category1 = @"10[Shoes]";
    p1.quantity = 1;
    p1.unitPriceTaxFree = 70;
    p1.unitPriceTaxIncluded = 85;
    p1.promotionalCode = @"ATInternet";
    p1.discountTaxFree = 0;
    p1.discountTaxIncluded = 0;
    
    Product *p2 = [self.tracker.cart.products addString:@"ID[p2]"];
    p2.category1 = @"20[Socks]";
    p2.quantity = 2;
    p2.unitPriceTaxFree = 5;
    p2.unitPriceTaxIncluded = 7;
    
    Order* order = [self.tracker.orders add:@"cmd1" turnover:94.30 status: 1];
    // First order from that custom
    order.isNewCustomer = YES;
    // Payment Method
    order.paymentMethod = 1;
    // Order Status
    order.status = 1;
    // Order amount
    [order.amount set:80 amountTaxIncluded: 94.30 taxAmount: 14];
    // Order delivery info
    [order.delivery set:5 shippingFeesTaxIncluded: 7.5 deliveryMethod: @"1[UPS]"];
    // Discount info
    [order.discount set:5 discountTaxIncluded: 7.5 promotionalCode: @"SUMMER"];
    
    Screen *confirmOrderScreen = [self.tracker.screens add:@"Order confirmation"];
    [confirmOrderScreen sendView];
    
    [self.tracker.cart unset];
}

@end
  1. Tagging an order confirmation screen on an app or external site
    The goal here is to be able to measure completed orders and reservations, despite the fact that the confirmation screen is hosted by an app or on an external site (like banking platforms, PayPal ). The tag must be placed on the screen preceding the user�s detour toward the banking or payment platform (the screen containing all information about the order/reservation and its content).

import UIKit
import Tracker

class ViewController: UIViewController {
    let tracker: Tracker = ATInternet.sharedInstance.defaultTracker
    
    override func viewDidLoad() {
        super.viewDidLoad()
    }
    
    override func viewWillAppear(_ animated: Bool) {        
        let order = tracker.orders.add("cmd1", turnover: 94.30, status: 1)
        // First order from that custom
        order.isNewCustomer = true
        // Payment Method
        order.paymentMethod = 1
        // Order Status
        order.status = 1
        // Order needs confirmation (bank validation)
        order.isConfirmationRequired = true
        // Order amount
        order.amount.set(80, amountTaxIncluded: 94.30, taxAmount: 14)
        // Order delivery info
        order.delivery.set(5, shippingFeesTaxIncluded: 7.5, deliveryMethod: "1[UPS]")
        // Discount info
        order.discount.set(5, discountTaxIncluded: 7.5, promotionalCode: "SUMMER")
        
        let myScreen = tracker.screens.add("Order info before payment")
        myScreen.sendView()
    }
}
#import "ViewController.h"
#import "SmartTracker/SmartTracker-Swift.h"

@interface ViewController ()
@property (nonatomic, strong) Tracker* tracker;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.tracker = [ATInternet sharedInstance].defaultTracker;
}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];

    Order* order = [self.tracker.orders add:@"cmd1" turnover:94.30 status: 1];
    // First order from that custom
    order.isNewCustomer = YES;
    // Payment Method
    order.paymentMethod = 1;
    // Order Status
    order.status = 1;
    // Order needs confirmation (bank validation)
    order.isConfirmationRequired = YES;
    // Order amount
    [order.amount set:80 amountTaxIncluded: 94.30 taxAmount: 14];
    // Order delivery info
    [order.delivery set:5 shippingFeesTaxIncluded: 7.5 deliveryMethod: @"1[UPS]"];
    // Discount info
    [order.discount set:5 discountTaxIncluded: 7.5 promotionalCode: @"SUMMER"];
    
    Screen *myScreen = [self.tracker.screens add:@"Order info before payment"];
    [myScreen sendView];
}

@end
  1. Tagging an order with the addition of custom variables

import UIKit
import Tracker

class ViewController: UIViewController {
    let tracker: Tracker = ATInternet.sharedInstance.defaultTracker
    
    override func viewDidLoad() {
        super.viewDidLoad()
    }
    
    override func viewWillAppear(_ animated: Bool) {        
        let order = tracker.orders.add("cmd1", turnover: 94.30, status: 1)
        // First order from that custom
        order.isNewCustomer = true
        // Payment Method
        order.paymentMethod = 1
        // Order Status
        order.status = 1
        // Order amount
        order.amount.set(80, amountTaxIncluded: 94.30, taxAmount: 14)
        // Order delivery info
        order.delivery.set(5, shippingFeesTaxIncluded: 7.5, deliveryMethod: "1[UPS]")
        // Discount info
        order.discount.set(5, discountTaxIncluded: 7.5, promotionalCode: "SUMMER")
        // Custom variables
        order.customVariables.add(1, value: "fr")
        order.customVariables.add(2, value: "fr_FR")
        
        let myScreen = tracker.screens.add("Order info before payment")
        myScreen.sendView()
    }
}
#import "ViewController.h"
#import "SmartTracker/SmartTracker-Swift.h"

@interface ViewController ()
@property (nonatomic, strong) Tracker* tracker;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.tracker = [ATInternet sharedInstance].defaultTracker;
}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];

    Order* order = [self.tracker.orders add:@"cmd1" turnover: 94.30 status: 1];
    // First order from that custom
    order.isNewCustomer = YES;
    // Payment Method
    order.paymentMethod = 1;
    // Order Status
    order.status = 1;
    // Order amount
    [order.amount set:80 amountTaxIncluded: 94.30 taxAmount: 14];
    // Order delivery info
    [order.delivery set:5 shippingFeesTaxIncluded: 7.5 deliveryMethod: @"1[UPS]"];
    // Discount info
    [order.discount set:5 discountTaxIncluded: 7.5 promotionalCode: @"SUMMER"];
    // Custom variables
    [order.customVariables add:1 value:@"fr"];
    [order.customVariables add:2 value:@"fr_FR"];
    
    Screen *myScreen = [self.tracker.screens add:@"Order info before payment"];
    [myScreen sendView];
}

@end

Wiki contents

Clone this wiki locally