Marketing campaigns

  • iOS
  • watchOS
  • tvOS
 

Foreword

AT Internet’s SDK allows you to tag different types of campaigns (ad, affiliation, sponsored links, email marketing).

 

Get off to a good start

Once your tag is initialised, you may add campaign 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 headers SmartTracker-Swift.h

 

Tagging

The screen object of the tracker has a campaign property available.

The SDK allows you to manage two modes of campaign “prior attribution”. You can choose to conserve the first or last detected campaign during a definitive period of time via your setup (by default, the first campaign will be conserved). This information will be found in your hit’s xtor variable. To modify the “prior attribution” mode, please proceed as follows:

  1. The first detected campaign will be conserved during the time period defined in the setup (30 days by default)

    import UIKit
    import Tracker
    
    class ViewController: UIViewController {
        let tracker: Tracker = ATInternet.sharedInstance.defaultTracker
        
        override func viewDidLoad() {
            super.viewDidLoad()
            tracker.setConfig(["campaignLastPersistence": "false", "campaignLifetime" : "10"], override: false) { (isSet) -> Void in
                print("Campaign configuration is now set")
            }
        }
    }
    #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 setConfig:@{@"campaignLastPersistence": @"false", @"campaignLifetime": @"10"} override:NO completionHandler:^(BOOL isSet) {
            NSLog(@"%@", @"Campaign configuration is now set");
        }];
    }
    
    @end
  2. The last detected campaign will be conserved during the time period defined in the setup (30 days by default)

    import UIKit
    import Tracker
    
    class ViewController: UIViewController {
        let tracker: Tracker = ATInternet.sharedInstance.defaultTracker
        
        override func viewDidLoad() {
            super.viewDidLoad()
            
            tracker.setConfig(["campaignLastPersistence": "true", "campaignLifetime" : "15"], override: false) { (isSet) -> Void in
                print("Campaign configuration is now set")
            }
        }
    }
    #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 setConfig:@{@"campaignLastPersistence": @"true", @"campaignLifetime": @"15"} override:NO completionHandler:^(BOOL isSet) {
            NSLog(@"%@", @"Campaign configuration is now set");
        }];
    }
    
    @end
 

Tagging examples

If you wish to simplify the tagging of your links without having to know the significance of each field, try the interface available in our marketplace. Please note that this interface has been created by our community and can be improved, so feel free to send us your feedback!

  1. Tagging an ad campaign

    In the case of an ad, the campaign ID format must respect the following rules:

    Mandatory:

    – A (source): prefix AD
    – B: campaign ID value (given by AT Internet)

    Optional:

    – C: creative (in the format [label] or id[label]).
    – D: variant (in the format [label] or id[label]).
    – E: format (according to IDs given by AT Internet and placed between []. You may also specify any other format of your choice by using the following nomenclature: “[name]”. Example: You can either give a label: [button], or a size: [120×40]).
    – F: site (specifying the URL in the format [url]).
    – G: general placement within the entire site (according to IDs given by AT Internet and placed between []).
    – H: details on the placement within the web page.

    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("Ad")
            screen.campaign = Campaign(campaignId: "AD-3030-[ad_Version_7]-[without_text]-[468]-[www.site.com]-[GT]-[top_page]")
            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:@"Ad"]; 
        // Enable cart and set an identifier
        screen.campaign = [[Campaign alloc] initWithCampaignId:@"AD-3030-[ad_Version_7]-[without_text]-[468]-[www.site.com]-[GT]-[top_page]"];
        [screen sendView];
    }
    
    @end
  2. Tagging an affiliation campaign

    In the case of affiliation, the campaign ID format must respect the following rules:

    Mandatory:

    – A (source): prefix AL
    – B: campaign ID value (in the format [label] or id[label])

    Optional:

    – C: affiliate type (in the format [label] or id[label])
    – D: affiliate ID (in the format [label] or id[label])
    – E: affiliate ad format (based on predefined IDs. You may also specify any other format of your choice by using the following nomenclature: “[name]”. Example: You can either give a label: [button], or a size: [120×40]).
    – F: creative ID (in the format [label] or id[label])
    – G: variant (in the format [label] or id[label])
    – C1*: custom variable to be declared in the interface (in the id[label])
    – C2*: custom variable to be declared in the interface (in the id[label])
    – C3*: custom variable to be declared in the interface (in the id[label])

    *not available in the Analytics Suite, should you need to study these please get back to the support

    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("Affiliation")
            screen.campaign = Campaign(campaignId: "AL-3030-1[comparison_shopper]-34253-[468]-4[cars_advertisement]-6[blue_version]|233[customer_name]-3425[id_contract]")
            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];
        // Enable cart and set an identifier
        Screen *screen = [self.tracker.screens add:@"Affiliation"]
        screen.campaign = [[Campaign alloc] initWithCampaignId:@"AL-3030-1[comparison_shopper]-34253-[468]-4[cars_advertisement]-6[blue_version]|233[customer_name]-3425[id_contract]"];
        [screen sendView];
    }
    
    @end
  3. Tagging a sponsored links campaign

    In the case of sponsored links, the campaign ID format must respect the following rules:

    Mandatory:

    – A (source): prefix SEC
    – B: campaign ID value (given by AT Internet)

    Optional:

    – C: platform ID (only if your campaign is distinct on each platform)
    – D: ad group (in the format [label] or id[label]). This variable is mandatory if importing Google AdWords data.
    – E: ad variation (in the format [label] or id[label]). By entering exactly [{creative}] in Google, Google will place a unique variation ID enabling linking to results during data imports from Google.
    – F: “S” or “C” according to whether it comes from search results (“S” for Search) or ads on content/display networks (“C” for Content).
    – G: the exact keyword bought. By entering exactly [{keyword}] for a campaign in Google, Google will automatically place the exact keyword bought (which may slightly differ from the keyword entered). The principle is similar for Yahoo ([{YSMKEY}]).

    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("Sponsored Link")
            screen.campaign = Campaign(campaignId: "SEC-300-GOO-[group_1]-[Var_1]-{ifContent:C}{ifSearch:S}-[{keyword}]&xts=1111111")
            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];
        // Enable cart and set an identifier
        Screen *screen = [self.tracker.screens add:@"Sponsored Link"];
        [self.tracker.campaigns addWithCampaignId:@"SEC-300-GOO-[group_1]-[Var_1]-{ifContent:C}{ifSearch:S}-[{keyword}]&xts=1111111"];
        [screen sendView];
    }
    
    @end
  4. Tagging an email marketing campaign

    In the case of email marketing, the campaign ID format must respect the following rules:

    Mandatory:

    – A (source): prefix EREC, EPR or ES
    – B: campaign ID value
    – C: email blast ID in the format [label] or id[label] (without this label, it will be impossible to get the email overlay analysis).

    Optional:

    – D: Email date in short format: YYYYMMDD
    – E: link ID in the format “[label]” (added by you, based on the link). Please only add if you would like the precise detail of user clicks (and notably email overlay analyses).
    Click specification depends on the customer’s preference: each link, or only the main areas.
    – F: List of contacts with contact ID in the format id@list (for example, 1435@1 for contact 1435 on list 1).
    – G: Precise date and time in long format: YYYYMMDDHHMMSS

    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("eMailing")
            screen.campaign = Campaign(campaignId: "EPR-300-[Presentation_service]-20070304-[link2]-1435@1-20070304130405")
            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:@"eMailing"]
        // Enable cart and set an identifier
        screen.campaign = [[Campaign alloc] initWithCampaignId:@"EPR-300-[Presentation_service]-20070304-[link2]-1435@1-20070304130405"];
        [screen sendView];
    }
    
    @end
 

Campaign class

 

Properties

NameTypeDefault valueDescription
campaignIdStringEmpty stringGets or sets the campaign ID
 

Force visit marketing source

This guide is only available for Analytics Suite Delta analysis.

The forced source is taken into account from the next day. The real-time functionalities (Data Query granular exports, or Data Flow) are still based on the classic source detection.

It is possible to force the marketing source of a visit even if we’ve already retrieved another one on past events.
For this, you have to set the src_force property (boolean) to true:

tracker.setProp("b:src_force", value: "true", persistent: false)

If several sources are forced during a visit, the last one filled in will be the one kept.

Last update: 04/04/2022