On-site ads
- iOS
- watchOS
- tvOS
Foreword
AT Internet’s SDK offers the measurement of your in-app ads so that you can evaluate their performance.
The goal is to measure “clicks” and impressions of self-promotion ad campaigns, as well as third-party campaigns displayed on your app, and then analyse this information.
To be sure to measure properly the Auto-Promotion campaign, please check if your campaign is declared in Settings > Marketing campaigns.
Get off to a good start
Once your tag is initialised, you can start tagging your in-app ads.
Dans le cas d’un projet Swift, veillez à importer le module SmartTracker (ou tvOSTracker / watchOSTracker si votre target est une Apple TV / Apple watch) dans votre ViewController. Dans le cas d’un projet Objective-C, veillez à importer les entêtes SmartTracker-Swift.h
Tagging
To tag your ads, the tracker exposes two properties, publishers and selfPromotions, according to the type of ad to be measured.
These two properties themselves expose two methods:
- add
- sendImpressions
The add method allows you to add an ad tag and put it in standby for send. This method returns an object with type Publisher or SelfPromotion according to the case in question.
To send the defined information, you must call the sendTouch or sendImpression method of your object, based on the type of action taken by the user, or call the Trackers dispatch method.
Please note, calling the methods sendTouch and sendImpression modifies the object’s action property.
The sendImpressions method allows sending of all information for ads whose action is defined as Impression.
Tagging examples
- Tagging an ad impression for a third-party
import UIKit import Tracker class ViewController: UIViewController { let tracker: Tracker = ATInternet.sharedInstance.defaultTracker override func viewDidLoad() { super.viewDidLoad() } override func viewWillAppear(animated: Bool) { tracker.publishers.add("[ad1]").sendImpression() } }
#import "ViewController.h" #import "SmartTracker/SmartTracker-Swift.h" @interface ViewController () @property (nonatomic, strong) Tracker* tracker; @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; } - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; [[self.tracker.publishers add:@"[ad1]"] sendImpression]; } @end
- Tagging an ad click for a third-party
@IBAction func touchAd(sender: UIButton) { ATInternet.sharedInstance.defaultTracker.publishers.add("[ad1]").sendTouch() }
- (IBAction)touchAd:(UIButton *)sender { [[[ATInternet sharedInstance].defaultTracker.publishers add:@"[ad1]"] sendTouch]; }
- Tagging a self-promotion campaign impression
import UIKit import Tracker class ViewController: UIViewController { let tracker: Tracker = ATInternet.sharedInstance.defaultTracker override func viewDidLoad() { super.viewDidLoad() } override func viewWillAppear(animated: Bool) { tracker.selfPromotions.add(1).sendImpression() } }
#import "ViewController.h" #import "SmartTracker/SmartTracker-Swift.h" @interface ViewController () @property (nonatomic, strong) Tracker* tracker; @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; } - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; [[self.tracker.selfPromotions add:1] sendImpression]; } @end
- Tagging an self-promotion campaign click
@IBAction func touchAd(sender: UIButton) { ATInternet.sharedInstance.defaultTracker.selfPromotions.add(1).sendTouch() }
- (IBAction)touchAd:(UIButton *)sender { [[[ATInternet sharedInstance].defaultTracker.selfPromotions add:1] sendTouch]; }
- Tagging several ads and sending impressions
50 impressions per page maximum
import UIKit import Tracker class ViewController: UIViewController { let tracker: Tracker = ATInternet.sharedInstance.defaultTracker override func viewDidLoad() { super.viewDidLoad() } override func viewWillAppear(animated: Bool) { let ad1 = tracker.publishers.add("[ad1]") ad1.creation = "[creation]" ad1.variant = "[variant]" ad1.format = "[120x40]" ad1.generalPlacement = "[generalPlacement]" ad1.detailedPlacement = "[detailedPlacement]" ad1.advertiserId = "1[advertiserId]" ad1.url = "[http://avertiser-url.com]" tracker.publishers.add("[ad2]") let ad3 = tracker.publishers.add("[ad3]") ad3.creation = "[creation]" ad3.variant = "[variant]" tracker.publishers.sendImpressions() } }
#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]; Publisher *ad1 = [self.tracker.publishers add:@"[ad1]"]; ad1.creation = @"[creation]"; ad1.variant = @"[variant]"; ad1.format = @"[120x40]"; ad1.generalPlacement = @"[generalPlacement]"; ad1.detailedPlacement = @"[detailedPlacement]"; ad1.advertiserId = @"1[advertiserID]"; ad1.url = @"[http://avertiser-url.com]"; [self.tracker.publishers add:@"[ad2]"]; Publisher *ad3 = [self.tracker.publishers add:@"[ad3]"]; ad3.creation = @"[creation]"; ad3.variant = @"[variant]"; [self.tracker.publishers sendImpressions]; } @end
- Tagging several self-promotion campaigns and sending impressions
import UIKit import Tracker class ViewController: UIViewController { let tracker: Tracker = ATInternet.sharedInstance.defaultTracker override func viewDidLoad() { super.viewDidLoad() } override func viewWillAppear(animated: Bool) { let sp1 = tracker.selfPromotions.add(1) sp1.format = "[120x40]" sp1.productId = "p1" tracker.selfPromotions.add(2) let sp3 = tracker.selfPromotions.add(3) sp3.productId = "p3" tracker.selfPromotions.sendImpressions() } }
#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]; SelfPromotion *sp1 = [self.tracker.selfPromotions add:1]; sp1.format = @"[120x40]"; sp1.productId = @"p1"; [self.tracker.selfPromotions add:2]; SelfPromotion *sp3 = [self.tracker.selfPromotions add:3]; sp3.productId = @"p3"; [self.tracker.selfPromotions sendImpressions]; } @end
- Tagging self-promotion ads and campaigns and using dispatcher
import UIKit import Tracker class ViewController: UIViewController { let tracker: Tracker = ATInternet.sharedInstance.defaultTracker override func viewDidLoad() { super.viewDidLoad() } override func viewWillAppear(animated: Bool) { tracker.publishers.add("[ad1]") tracker.publishers.add("[ad2]") tracker.selfPromotions.add(1) // This will send one hit with publishers and selfpromotion impressions tracker.dispatch() } }
#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.publishers add:@"[ad1]"]; [self.tracker.publishers add:@"[ad2]"]; [self.tracker.selfPromotions add:1]; // This will send one hit with publishers and selfpromotion impressions [self.tracker dispatch]; } @end
- Tagging self-promotion ads and campaigns and adding screen information
import UIKit import Tracker class ViewController: UIViewController { let tracker: Tracker = ATInternet.sharedInstance.defaultTracker override func viewDidLoad() { super.viewDidLoad() } override func viewWillAppear(animated: Bool) { tracker.publishers.add("[ad1]") tracker.publishers.add("[ad2]") tracker.selfPromotions.add(1) tracker.screens.add("Home").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.publishers add:@"[ad1]"]; [self.tracker.publishers add:@"[ad2]"]; [self.tracker.selfPromotions add:1]; [[self.tracker.screens add:@"Home"] sendView]; } @end
- Tagging a screen impression
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("Home") _ = screen.publishers.add("[ad1]") 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]; Screen *screen = [[self.tracker screens] add:@"Home"]; [screens.publishers add:@"[ad1]"]; [screen sendView]; } @end