Configuration

  • iOS
  • watchOS
  • tvOS
 

Foreword

To facilitate integration of your tag, the Tag Composer application allows you to configure and download our SDK.

These configuration variables are listed in the tracker’s DefaultConfiguration.plist file.

You may specify different configurations by type of device by creating .plist files and adding the type of device to the file name (e.g. DefaultConfiguration~ipad.plist, DefaultConfiguration~iphone.plist…).

We recommend setting the configuration secure to true, since OS can block non-secure requests.

 

Editing the configuration

At any moment, you may change your tag’s configuration.

When creating a tracker:

let myConfiguredTracker = ATInternet.sharedInstance.tracker("myConfiguredTracker", configuration: ["log":"YOURLOG", "logSSL":"YOURSSLLOG", "domain":"YOURDOMAINLOG", "pixelPath":"/hit.xiti", "site":"YOURSITEID", "secure":"true", "identifier":"uuid", "plugins":"", "enableBackgroundTask":"true", "storage":"required", "hashUserId":"false", "persistIdentifiedVisitor":"true", "campaignLastPersistence": "false", "campaignLifetime": "30", "sessionBackgroundDuration": "60"])
Tracker* myConfiguredTracker = [[ATInternet sharedInstance] tracker:@"myConfiguredTracker" configuration:@{@"log":@"YOURLOG", @"logSSL":@"YOURSSLLOG", @"domain":@"YOURDOMAINLOG", @"pixelPath":@"/hit.xiti", @"site":@"YOURSITEID", @"secure":@"true", @"identifier":@"uuid", @"plugins":@"", @"enableBackgroundTask":@"true", @"storage":@"required", @"hashUserId":@"false", @"persistIdentifiedVisitor":@"true", @"campaignLastPersistence": @"false", @"campaignLifetime": @"30",@"sessionBackgroundDuration": @"60"}];

Via use of the tracker’s setConfig method:

Please note, the setConfig method is an asynchronous method. To ensure that the configuration was successfully applied, a callback indicating that the configuration was successfully applied is available.

  1. Modification of a configuration key:

    tracker.setConfig("secure", value: "true") { (isSet) -> Void in
        print("Tracker is now using SSL")
    }
    [self.tracker setConfig:@"secure" value:@"true" sync:NO completionHandler:^(BOOL isSet) {
        NSLog(@"%@", @"Tracker is now using SSL");
    }];
  2. Replacement of certain configuration keys:

    Only keys passed as parameters will be modified or added to the existing configuration

    tracker.setConfig(["secure": "true", "site": "YOURSITEID", "hashUserId": "true"], override: false) { (isSet) -> Void in
        print("Configuration is now set")
    }
    [self.tracker setConfig:@{@"secure": @"true", @"site": @"YOURSITEID", @"hashUserId": @"true"} override: NO sync:NO completionHandler:^(BOOL isSet) {
        NSLog(@"%@", @"Configuration is now set");
    }];

 

Since 2.2.0 version, it’s possible to use helpers and constants to simplify configuration management.

  1. Samples to use helpers

    // Log
    ATInternet.sharedInstance.defaultTracker.setLog("YOURLOG") { (isSet) -> Void in
        print("Your new log is set")
    }
            
    // Secured Log
    ATInternet.sharedInstance.defaultTracker.setSecuredLog("YOURSSLLOG") { (isSet) -> Void in
        print("Your new secured log is set")
    }
            
    // Site id
    ATInternet.sharedInstance.defaultTracker.setSiteId(YOURSITEID) { (isSet) -> Void in
        print("Your new site id is set")
    }
    // Log
    [[[ATInternet sharedInstance]defaultTracker]setLog:@"YOURLOG" sync:NO completionHandler:^(BOOL isSet) {
        NSLog(@"Your new log is set");
    }];
        
    // Secured Log
    [[[ATInternet sharedInstance]defaultTracker]setSecuredLog:@"YOURSSLLOG" sync:NO completionHandler:^(BOOL isSet) {
        NSLog(@"Your new secured log is set");
    }];
        
    // Site id
    [[[ATInternet sharedInstance]defaultTracker]setSiteId:YOURSITEID sync:YES completionHandler:nil];

     

  2. Samples to use constants (all constants are available in TrackerConfigurationKeys in Swift, prefixed by AT_CONF_ in Objective-C)

    // Log
    ATInternet.sharedInstance.defaultTracker.setConfig(TrackerConfigurationKeys.Log, value: "YOURLOG", completionHandler: { (isSet) -> Void in
        print("Your new log is set")
    })
                
    // Secured Log
    ATInternet.sharedInstance.defaultTracker.setConfig(TrackerConfigurationKeys.LogSSL, value: "YOURSSLLOG", completionHandler: { (isSet) -> Void in
        print("Your new secured log is set")
    })
            
    // Site id
    ATInternet.sharedInstance.defaultTracker.setConfig(TrackerConfigurationKeys.Site, value: "YOURSITEID", completionHandler: { (isSet) -> Void in
        print("Your new site id is set")
    })
    // Log
    [[[ATInternet sharedInstance]defaultTracker]setConfig:TrackerConfigurationKeys.Log value:@"YOURLOG" sync:NO completionHandler:^(BOOL isSet) {
        NSLog(@"Your new log is set");
    }];
        
    // Secured Log
    [[[ATInternet sharedInstance]defaultTracker]setConfig:TrackerConfigurationKeys.LogSSL value:@"YOURSSLLOG" sync:NO completionHandler:^(BOOL isSet) {
        NSLog(@"Your new secured log is set");
    }];
        
    // Site id
    [[[ATInternet sharedInstance]defaultTracker]setConfig:TrackerConfigurationKeys.Site value:@"YOURSITEID" sync:NO completionHandler:^(BOOL isSet) {
        NSLog(@"Your new site id is set");
    }];
 

List of variables

NameDefault valueDescription
logSets the hit collect log
logSSLSets the secure hit collect log (ATS compliant)
domainxiti.comSets the domain of the collect log
pixelPath/hit.xitiSets the path of the transparent pixel
siteSets the site ID
securefalseEnables use of SSL mode
identifieruuidSets type of user ID (uuid, idfv)
storageneverSets mode of hit storage (required, never, always)
enableBackgroundTasktrueAllows sending of offline hits when app is sent to background via creation of a backgroundTask
hashUserIdfalseEnables hashing of user ID (sha256)
persistIdentifiedVisitortrueEnables storage of identified user information (numerical or text)
pluginsEnables one or several plugins (e.g:nuggad). Plugins are separated by commas
campaignLifetime30Sets campaign lifetime (by default: 30 days)
campaignLastPersistencefalseSets the mode of prior attribution (by default, subsequent actions will be attributed to the first campaign detected)
sessionBackgroundDuration60Sets the duration, in seconds, between two sessions after the app enters in background
sendOnlyWhenAppActive (deprecated since v2.11.3)falseAvoid sending hits when app is not active (background or inactive). Since v2.9.7
sendOnApplicationStateallAllows you to send or not hits depending on the application state. Since v2.11.3
ignoreLimitedAdTrackingtrueAllows to take into account the limited ad tracking OS configuration: hits will be considered as opt-out (true), otherwise a GUID will be used for user identification (false). Since v2.12.2
sendHitWhenOptOuttrueAllows sending anonymous hits when the user is in “opt-put” mode. Since v2.13.0
UUIDDuration397(UUID) Define UUID lifetime
UUIDExpirationModefixed(UUID) Define UUID expiration mode (possible values : fixed, relative)
Last update: 24/09/2020