-
Notifications
You must be signed in to change notification settings - Fork 0
Cart 360cd1
AT Internet�s SDK allows you to tag your application�s basket or cart, as well as its contents.
As with a real cart, you can add or remove products from the cart and send this information in your screen hit.
Once your tag is initialised, you can add cart information to your screen hit.
In the case of a Swift project, be sure to import the Tracker (or TrackerExtension if your target is an extension) module in your ViewController. In the case of an Objective-C project, be sure to import SmartTracker-Swift.h
The tracker makes a cart property available. This property exposes the following methods:
-
set : Allows you to define a cart ID to then be able to add products
So that cart information is successfully taken into account, the ID must be greater than zero
- unset: Allows you to remove products from the cart and to reset the cart�s ID
The cart property also exposes a products property allowing you to add or remove products to/from the cart.
The products property exposes the following methods:
- add : Adds a product to the cart and returns a Product object
- remove: Deletes a product from the cart
- removeAll:Removes all products contained in the cart
To send cart information without sending order information, you must define the property isBasketScreen of your Screen object as ***true.***If not, cart information will not be added to your screen hit.
-
Tagging a screen summarising the content of a cart with 2 articles
The cart ID must be identical to the ID present in the order content tag; if not, the cart will be considered as abandoned. Please also remember, the ID used for the cart must be unique and should never be reused, in order to avoid inconsistencies in your analyses.
import UIKit
import Tracker
class ViewController: UIViewController {
let tracker: Tracker = ATInternet.sharedInstance.defaultTracker
override func viewDidLoad() {
super.viewDidLoad()
}
override func viewWillAppear(animated: Bool) {
// Enable cart and set an identifier
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 cartScreen = tracker.screens.add("Cart resume")
// If isBasketScreen is not set to true, Cart info won't be added to Screen hit
cartScreen.isBasketScreen = true
cartScreen.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];
// Enable cart and set an identifier
[self.tracker.cart set:@"1"];
Product *p1 = [self.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;
Product *p2 = [self.tracker.cart.products add:@"ID[p2]"];
p2.category1 = @"20[Socks]";
p2.quantity = 2;
p2.unitPriceTaxFree = 5;
p2.unitPriceTaxIncluded = 7;
Screen* cartScreen = [self.tracker.screens add:@"Cart resume"];
// If isBasketScreen is not set to true, Cart info won't be added to Screen hit
cartScreen.isBasketScreen = YES;
[cartScreen sendView];
}
@end-
Tagging an order with cart information
For more information on tagging your orders, visit this page: Orders (SalesTracker)
import UIKit
import Tracker
class ViewController: UIViewController {
let tracker: Tracker = ATInternet.sharedInstance.defaultTracker
override func viewDidLoad() {
super.viewDidLoad()
tracker.debugger = self
}
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 customer
order.isNewCustomer = 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 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;
self.tracker.debugger = self;
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self.tracker.cart set:@"1"];
Product *p1 = [self.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;
Product *p2 = [self.tracker.cart.products add:@"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 customer
order.isNewCustomer = 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 *confirmOrderScreen = [self.tracker.screens add:@"Order confirmation"];
[confirmOrderScreen sendView];
[self.tracker.cart unset];
}
@end-
Resetting a cart after having completed an order
@IBAction func finishOrder(sender: UIButton) {
// Reset cart ID and remove all products
tracker.cart.unset()
}- (IBAction)finishOrder:(UIButton *)sender {
[self.tracker.cart unset];
}-
Replacing an existing cart
@IBAction func reinitCart(sender: UIButton) {
// Set a new identifier for cart
tracker.cart.set("2")
}- (IBAction)reinitCart:(UIButton *)sender {
[self.tracker.cart setWithId:@"2"];
}-
Adding products to the cart
@IBAction func addProduct2Cart(sender: UIButton) {
let p1 = tracker.cart.products.add("ID[p1]")
p1.category1 = "10[Shoes]"
p1.quantity = 1
p1.unitPriceTaxFree = 60
p1.unitPriceTaxIncluded = 75
p1.promotionalCode = "SUMMER"
p1.discountTaxFree = 5
p1.discountTaxIncluded = 7.5
}- (IBAction)addProductToCart:(UIButton *)sender {
Product *p1 = [self.tracker.cart.products add:@"ID[p1]"];
p1.category1 = @"10[Shoes]";
p1.quantity = 1;
p1.unitPriceTaxFree = 60;
p1.unitPriceTaxIncluded = 75;
p1.promotionalCode = @"SUMMER";
p1.discountTaxFree = 5;
p1.discountTaxIncluded = 7.5;
}-
Removing a product from the cart
@IBAction func removeProductFromCart(sender: UIButton) {
tracker.cart.products.remove("ID[p1]")
}- (IBAction)removeProductFromCart:(UIButton *)sender {
[self.tracker.cart.products remove:@"ID[p1]"];
}-
Removing all products in the cart
@IBAction func emptyCart(sender: UIButton) {
tracker.cart.products.removeAll()
}- (IBAction)emptyCart:(UIButton *)sender {
[self.tracker.cart.products removeAll];
}-
Data API
- Data flow
- Advice optimizations data flow
- Error codes data flow
- Faq data flow
- General information data flow
- Technical information data flow
- Reporting API v3
- Getting started
- Methods
- Parameters
- Technical information
- REST API
- Campaigns
- Custom variables
- Getting started rest
- Methods rest
- Response structure parameters rest
- Fixed periods
- Parameters compatibility
- Relative periods
- Structure of the response
- “code” parameter
- “columns” parameter
- “evo” parameter
- “filter” parameter
- “include” parameter
- “lng” parameter
- “max-results” parameter
- “page-num” parameter
- “period” parameter
- “period” parameter: “H” v. “He” & “MN” v. “MNe”
- “retention” parameter
- “segmentdesc” parameter
- “segment” parameter
- “sep” parameter
- “sort” parameter
- “space” parameter
- Technical specifications rest
- Data flow
-
Data collection
- Android
- Advanced features
- Campaigns
- Changelog
- Content
- Ecommerce
- Getting started
- Users
- Apple
- Advanced features
- Campaigns
- Changelog
- Content
- Ecommerce
- Getting started
- Users
- General
- Cddc renew staging process
- Changelog
- Craft your hit
- Encoded parameters
- Server side cookie management
- Supported taggings
- Tagging deletion
- Utilisation of dispatch sdks
- JavaScript
- Advanced features
- Campaigns
- Changelog
- Content
- Ecommerce
- Getting started
- Partners javascript
- Users
- Piano Analytics
- Event tagging piano analytics
- Getting started piano analytics
- Piano analytics tagging
- Feeding piano analytics with as2 tagging
- Tagging custom properties sdk
- Android