• Developer Guide
  • SDK Integration

iOS SDK

SDK Setup

SDK Installation

CocoaPods

  1. Create a Podfile file with the below commands.

    12
    cd path/to/project
    touch Podfile

  2. Edit Podfile as below.

    Podfile
    123
    target '[Project Name]' do
        pod 'AirBridge', '1.36.5'
    end

    Airbridge iOS SDK 1.18.0+ requires CocoaPods 1.11.0+

  3. Run the following commands in your terminal.

    12
    cd path/to/project
    pod install --repo-update

    When no pod command is found, install cocoapods with the below command.

    • sudo gem install cocoapods

Swift Package Manager (SPM)

The iOS SDK can be installed through Swift Package Manager (SPM). SDK versions 1.23.01.24.0 and 1.24.4+ currently support SPM.

  1. Move to "File" → "Add Packages" in Xcode.

  2. Add the Airbridge iOS SDK
    Search for "https://github.com/ab180/airbridge-ios-sdk-deploy" once the "Add Packages" window pops up. Select the version to be installed and click the "Add Package" button.

  3. Select Target for Package Installation.

  4. Check Package Installation.
    Airbridge will be shown under "Package Dependencies" if the SDK was properly installed.

Direct Installation

1. Adding the AirBridge.framework

  1. Download AirBridge.framework

  2. Click "Xcode → Project file → General → Frameworks, Libraries, and Embedded Content → +"

  3. Click "Add Other.. → Add Files.." at the bottom right hand corner

  4. Add the AirBridge.xcframeworkfolder that is in the file downloaded at step 1.

  5. Set AirBridge.xcframeworkas "Do not Embed".

2. Adding Dependency Frameworks

  1. Click "Xcode → Project file → General → Frameworks, Libraries, and Embedded Content → +".

  2. Add the 6 frameworks in the table below.

  3. Set these frameworks as "Do not Embed"

  4. Go to "Xcode → Project file → Build Phase → Link Binary with Libraries".

  5. Set the below six frameworks' statuses to Optional.

Framework

Description

AdSupport.framework

Used to collect IDFA.

iAd.framework

Used to collect Apple search ads attribution.

CoreTelephony.framework

Used to collect carrier information.

StoreKit.framework

Used to collect SKAdNetwork information.

AppTrackingTransparency.framework

Used to collect tracking authorization status.

AdServices.framework

Used to collect Apple Search Ads attribution information. (iOS 14.3+)

Project Setup

Initialization

Initialize SDK by adding following code at the beginning of the application:didFinishLaunchingWithOptions: method in the AppDelegate file.

123456
#import <AirBridge/AirBridge.h>

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {
    [AirBridge getInstance:@"YOUR_APP_TOKEN" appName:@"YOUR_APP_NAME" withLaunchOptions:launchOptions];
    ...
}

If you're using an environment where AppDelegate doesn't exist (e.g. SwiftUI), you would initialize the SDK through the App class under @main.

1234567891011121314151617
// YourprojectApp.swift

import SwiftUI
import AirBridge

@main
struct OnlyUIApp: App {
    init() {
        AirBridge.getInstance("YOUR_APP_TOKEN", appName: "YOUR_APP_NAME")
    }
    
    var body: some Scene {
        WindowGroup {
            ContentView()
        }
    }
}

YOUR_APP_NAME can be found at the "Airbridge dashboard → Settings → Tokens → App Name". YOUR_APP_TOKEN can be found at the "Airbridge dashboard → Settings → Tokens → App SDK Token".

Accept IDFA Terms and Conditions

In order to use the SDK, you must agree to the "IDFA terms and conditions" when publishing the application to the App Store.

  1. Click "Yes" to "Does this app use the Advertising Identifier (IDFA)?

  2. Check "Attribute this app Install to a previously served advertisement".

  3. Check "Attribute an action taken within this app to a previously served advertisement".

  4. Check "Limit Ad Tracking Setting in iOS".

Testing the SDK

Check if "install" events are being sent when installing and running the application.

Check in the Airbridge Dashboard

Events from the SDK are shown on the "Airbridge Dashboard → Raw Data → App Real-time Logs".

  1. Go to "Airbridge Dashboard → Raw Data → App Real-time Logs".

  2. Search for your "iOS IDFA" in the search box.

Logs may be delayed for up to 5 minutes.

Check with Logs

Logs will be printed to Xcode if you insert the following at the beginning of the code that initializes the SDK in your AppDelegate file.

12
[AirBridge setLogLevel:AB_LOG_ALL];
[AirBridge getInstance:@"YOUR_APP_TOKEN" appName:@"YOUR_APP_NAME" withLaunchOptions:launchOptions];


Dashboard Setup

The following information is needed at "Airbridge Dashboard → Tracking Link → Deep Link".

  • iOS URI Scheme

  • iOS App ID

iOS URI Scheme

Enter the URI scheme that will be used, including ://, in the iOS URI Scheme area as shown in the picture above.

e.g. example://yoururischeme://

Attention

The URI scheme must be entered differently for the production app, which is the app that has already been released on app stores or is planning to be released, and the test app.

If the same URI scheme is entered for the production app and test app, the deep link may open an unintended app page.

iOS App ID

  1. Go to Identifiersat https://developer.apple.com/account/resources.

  2. Click identifier of the application that you want to track.

  3. Copy the identifier information to "iOS App ID" at the Airbridge dashboard in the following format: "App ID Prefix" + "." + "Bundle ID" (e.g. 9JA89QQLNQ.com.apple.wwdc)

Project Setup

Scheme

  1. Go to "Xcode → Project file → Info → URL Types".

  2. From the Airbridge dashboard, copy "iOS URI Scheme" to Xcode's "URL Schemes". (Do not include ://)

  1. Go to "Xcode → Project file → Signing & Capabilities".

  2. Click "+ Capability" and add "Associated Domains".

  3. Add applinks:YOUR_APP_NAME.airbridge.ioto "Associated Domains".

  4. Add applinks:YOUR_APP_NAME.abr.geto "Associated Domains".

YOUR_APP_NAME can be found at the "Airbridge dashboard → Settings → Tokens → App Name".

Please refer to Troubleshooting → Webcredentials if you want to use the autofill feature.

For projects using AppDelegate

Events are usually sent through the application(_:open:options:) method in AppDelegate for apps that support iOS 12 and below.

  1. Open ios/[Project name]/AppDelegate.

  2. Send deeplink information to the SDK when the application is opened through schemes by calling the handleURLSchemeDeeplink method at the beginning of the following function.

    12345678
    - (BOOL)application:(UIApplication *)application
                openURL:(NSURL *)url
                options:(NSDictionary<UIApplicationOpenURLOptionsKey, id>*)options
    {
        [AirBridge.deeplink handleURLSchemeDeeplink:url];
    
        return YES;
    }

  3. Send deeplink information to the SDK when the application is opened through an universal link by calling the handleUserActivitymethod at the beginning of the following function.

    12345678
    -  (BOOL)application:(UIApplication*)application
    continueUserActivity:(NSUserActivity*)userActivity
      restorationHandler:(void (^)(NSArray* _Nullable))restorationHandler
    {
        [AirBridge.deeplink handleUserActivity:userActivity];
    
        return YES;
    }

    Attention

    Links are forwarded to SceneDelegate, not AppDelegate, for projects using SceneDelegate. Please refer to the next section on how to receive deep links through SceneDelegate.

For projects using SceneDelegate

Deep links are forwarded to the following methods for projects that use SceneDelegate and support iOS 13+.

  • When the application was loaded from a "Not running" status.

    • scene(_:willConnectTo:options:)

  • All other situations (e.g. background)

    • Universal link: scene(_:continue:)

    • Scheme link: scene(_:openURLContexts:)

123456789101112131415161718192021222324252627282930313233343536
import UIKit
import AirBridge

@available(iOS 13, *)
class SceneDelegate: UIWindowSceneDelegate {
    var window: UIWindow?

    // Receive links after the app's killed 
    func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
        if let schemeLinkURL = connectionOptions.urlContexts.first?.url {
            // Scheme
            AirBridge.deeplink()?.handleURLSchemeDeeplink(schemeLinkURL)
        } else if let userActivity = connectionOptions.userActivities.first {
            // Universal
            AirBridge.deeplink()?.handle(userActivity)
        }
        
        // ...
    }
  
    // Receive universal link
    func scene(_ scene: UIScene, continue userActivity: NSUserActivity) {
        AirBridge.deeplink().handle(userActivity)
        // ...
    }
  
    // Receive scheme link
    func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
        guard let schemeLinkURL = URLContexts.first?.url else {
             return
        }
        
        AirBridge.deeplink().handleURLSchemeDeeplink(schemeLinkURL)
        // ...
    }
}

For Projects using neither AppDelegate nor SceneDelegate (SwiftUI)

If you are using SwiftUI without SceneDelegate, deep links would be forwarded through onOpenURL. This method would be added to your App class under @main.

123456789101112131415161718192021222324
import SwiftUI
import AirBridge

@main
@available(iOS 14, *)
struct OnlyUIApp: App {

    ...
    
    var body: some Scene {
        WindowGroup {
            ContentView()
                .onOpenURL { url in
                    if url.scheme != "http" && url.scheme != "https" {
                        // Scheme link
                        AirBridge.deeplink()?.handleURLSchemeDeeplink(url)
                    }
                }
                .onContinueUserActivity(NSUserActivityTypeBrowsingWeb) { userActivity in
                    AirBridge.deeplink()?.handle(userActivity)
               }
        }
    }
}

Attention

If SceneDelegate is being used in your SwiftUI environment, onOpenUrl cannot be used. Please refer to the For projects using SceneDelegate section.

If you are using AppDelegate

  1. Open ios/[Project file]/AppDelegate.

  2. Use the setDeeplinkCallbackmethod to setup the callback that will be called when the application is opened through a deep link.

12345678
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {
    [AirBridge getInstance:@"YOUR_APP_TOKEN" appName:@"YOUR_APP_NAME" withLaunchOptions:launchOptions];

    [AirBridge.deeplink setDeeplinkCallback:^(NSString* deeplink) {
        // Deeplink from airbridge = YOUR_SCHEME://...
        NSLog(@"DeeplinkCallback : %@", deeplink);
    }];
}

If you are not using AppDelegate (SwiftUI)

Please add the following method to the App class under @main.

12345678910111213141516171819
import SwiftUI
import AirBridge

@main
@available(iOS 14, *)
struct OnlyUIApp: App {
    init() {
        AirBridge.getInstance("YOUR_APP_TOKEN", appName: "YOUR_APP_NAME")
        AirBridge.deeplink()?.setDeeplinkCallback { deeplink in
            print(deeplink)
        }
    }
    
    var body: some Scene {
        WindowGroup {
            ContentView()
        }
    }
}

All deep links that open apps are sent to DeeplinkCallback Of those deep links, "Airbridge deep links" will be sent using the "iOS URI Scheme" (YOUR_SCHEME://...) that was set in the Airbridge dashboard.A deferred deep link will be sent to DeeplinkCallback if ATT status is approved or a timeout occurs.
A deferred deep link will contain a deferred=true query parameter.

For Airbridge iOS SDK 1.10.0 ~ 1.10.9, the "Airbridge deep link" will be sent as https://YOUR_APP_NAME.airbridge.io/....For Airbridge iOS SDK ~1.9.10, the "Airbridge deep link" will be sent as either https://YOUR_APP_NAME.airbridge.io/... or YOUR_SCHEME://....

Custom Domain Setting (Optional)

If you are using a custom domain as an Airbridge tracking link, follow the below steps. (Replace example.com with custom domain)

  • Go to "Xcode → Project file → Signing & Capabilities → Associated Domains".

  • Click "+" button and add applinks:example.com.

  • Open info.plist.

  • Add the following value.

Check if the application is run and the deep link event is sent when "Airbridge deep links" are clicked on. Make sure that the deep link follows the "iOS URI Scheme" format configured in your Airbridge dashboard. (e.g. example://)

  1. Click deep link

  2. See if the deep link event appears at "Airbridge dashboard → Raw Data → App Real-time Logs"

User Setup


User Identifier Setup

Once a user identifier information is sent to the SDK, all events thereafter will contain the corresponding user identifier information.

12345678
[AirBridge.state setUserID:@"personID"];
[AirBridge.state setUserEmail:@"persondoe@airbridge.io"];
[AirBridge.state setUserPhone:@"1(123)123-1234"]

// user alias changed with inserted dictionary.
[AirBridge.state setUserAlias:@{@"key": @"value"}];
// key, value is inserted to existed user alias.
[AirBridge.state addUserAliasWithKey:@"key" value:@"value"];

Name

Description

Limitations

ID

User ID

-

Email

User Email

Hashed by default
(SHA256, can be disabled)

Phone

User phone number

Hashed by default
(SHA256, can be disabled)

Alias

User alias

- Maximum 10 aliases
- keytype is NSString, maximum 128 characters
- keymust satisfy ^[a-zA-Z_][a-z0-9_]*$regex
valuetype is NSString, maximum 128 characters

User Attributes Setup

Additional user attributes can be used for a more accurate MTA (Multi-Touch Attribution) analysis, additional internal data analysis, and linking third-party solutions.

1234
// user attributes changed with inserted dictionary.
[AirBridge.state setUserAttributes:@{@"key": @"value"}];
// key, value is inserted to existed user attributes.
[AirBridge.state addUserAttributesWithKey:@"key" value:@"value"];

Name

Description

Limit

Attributes

User attributes

- Maximum 100 attributes
- keytype is NSString, maximum 128 characters
keymust satisfy ^[a-zA-Z_][a-z0-9_]*$regex
valuetype is NSString or NSNumber
- Maximum 1024 characters for NSString type

Test User Information Setup

Make sure that your user information settings are being properly sent through the SDK.

  1. Configure user identifier information.

  2. Send an event using the SDK.

  3. Click the event at "Airbridge dashboard → Raw Data → App Real-time Logs"

  4. Check if the user information is correctly sent under the userblock.

Device Setup


Setup Device Alias

Setup a device alias through the Airbridge SDK. The alias will be sustained even after the app closes, unless otherwise deleted.

123
[AirBridge.state setDeviceAliasWithKey: "ADD_YOUR_KEY", value: "AND_YOUR_VALUE"];
[AirBridge.state removeDeviceAliasWithKey: "DELETE_THIS_KEY"];
[AirBridge.state clearDeviceAlias];

Method

Description

setDeviceAlias(withKey: String, value: String)

Add the key value pair to the device identifier.

removeDeviceAlias(withKey: String)

Delete the corresponding device alias.

clearDeviceAlias()

Delete all device aliases.

Event Setup


When important user actions occur, in-app events can be sent to measure the performance of each channel.

All event parameters are optional. However, more information about the event will help provide a more accurate analysis.

Sending Events

Send events with the SDK.

123456789101112131415161718192021
#import <AirBridge/ABInAppEvent.h>

ABInAppEvent* event = [[ABInAppEvent alloc] init];

[event setCategory:@"category"];
[event setAction:@"action"];
[event setLabel:@"label"];
[event setValue:@(123)];
[event setCustoms:@{@"key": @"value"}];

// Semantic Attributes Option 1
ABSemanticAttributes* semanticAttributes = [[ABSemanticAttributes alloc] init];
semanticAttributes.transactionID = @"transaction_123";
[event setSemanticAttributes:semanticAttributes];

// Semantic Attributes Option 2
// For more details, please check following page
// https://developers.airbridge.io/docs/event-structure#semantic-attributes
[event setSemantics:@{@"transactionID": @"transaction_123"}];

[event send];

Parameter

Description

setCategory

Event name (required)

setAction

Event attribute 1

setLabel

Event attribute 2

setValue

Event attribute value

setCustoms

Additional custom attributes

setSemanticAttributes

Additional semantic attributes (Map)

Standard Events

Send standard user events with the SDK.

setActionsetLabelsetValuesetCustomssetSemanticssetSemanticAttributes can also be used when sending standard events.

User Sign Up

123456789101112131415161718192021
#import <AirBridge/ABUser.h>
#import <AirBridge/ABInAppEvent.h>
#import <AirBridge/ABCategory.h>

ABUser* user = [[ABUser alloc] init];
user.ID = @"testID";
user.email = @"testID@ab180.co";
user.phone = @"000-0000-0000";
user.alias = @{
    @"key": @"value",
};
user.attributes = @{
    @"key": @"value",
};

[AirBridge.state setUser:user];

ABInAppEvent* event = [[ABInAppEvent alloc] init];
[event setCategory:ABCategory.signUp];

[event send];

User Sign In

123456789101112131415161718192021
#import <AirBridge/ABUser.h>
#import <AirBridge/ABInAppEvent.h>
#import <AirBridge/ABCategory.h>

ABUser* user = [[ABUser alloc] init];
user.ID = @"testID";
user.email = @"testID@ab180.co";
user.phone = @"000-0000-0000";
user.alias = @{
    @"key": @"value",
};
user.attributes = @{
    @"key": @"value",
};

[AirBridge.state setUser:user];

ABInAppEvent* event = [[ABInAppEvent alloc] init];
[event setCategory:ABCategory.signIn];

[event send];

User Sign Out

1234567
#import <AirBridge/ABInAppEvent.h>
#import <AirBridge/ABCategory.h>

ABInAppEvent* event = [[ABInAppEvent alloc] init];
[event setCategory:ABCategory.signOut];

[AirBridge.state setUser:[[ABUser alloc] init]];

View Home Screen

1234567
#import <AirBridge/ABInAppEvent.h>
#import <AirBridge/ABCategory.h>
  
ABInAppEvent* event = [[ABInAppEvent alloc] init];
[event setCategory:ABCategory.viewHome];

[event send];

View Product Detail

1234567891011121314151617181920
#import <AirBridge/ABProduct.h>
#import <AirBridge/ABInAppEvent.h>
#import <AirBridge/ABCategory.h>
#import <AirBridge/ABSemanticsKey.h>

ABProduct* product1 = [[ABProduct alloc] init];
product1.idx = @"idx1";
product1.name = @"name1";
product1.price = @100;
product1.currency = @"USD";
product1.orderPosition = @1;
product1.quantity = @1;

ABInAppEvent* event = [[ABInAppEvent alloc] init];
[event setCategory:ABCategory.viewProductDetail];
[event setSemantics:@{
    ABSemanticsKey.products: @[product1.toDictionary],
}];

[event send];

View Product List

1234567891011121314151617181920212223242526272829303132
#import <AirBridge/ABProduct.h>
#import <AirBridge/ABInAppEvent.h>
#import <AirBridge/ABCategory.h>
#import <AirBridge/ABSemanticsKey.h>

ABProduct* product1 = [[ABProduct alloc] init];
product1.idx = @"idx1";
product1.name = @"name1";
product1.price = @100;
product1.currency = @"USD";
product1.orderPosition = @1;
product1.quantity = @1;

ABProduct* product2 = [[ABProduct alloc] init];
product2.idx = @"idx2";
product2.name = @"name2";
product2.price = @200;
product2.currency = @"USD";
product2.orderPosition = @2;
product2.quantity = @2;

ABInAppEvent* event = [[ABInAppEvent alloc] init];
[event setCategory:ABCategory.viewProductList];
[event setSemantics:@{
    ABSemanticsKey.products: @[
        product1.toDictionary,
        product2.toDictionary,
    ],
    ABSemanticsKey.productListID: @"listID",
}];

[event send];

View Search Result

1234567891011121314151617181920212223242526272829303132
#import <AirBridge/ABProduct.h>
#import <AirBridge/ABInAppEvent.h>
#import <AirBridge/ABCategory.h>
#import <AirBridge/ABSemanticsKey.h>

ABProduct* product1 = [[ABProduct alloc] init];
product1.idx = @"idx1";
product1.name = @"name1";
product1.price = @100;
product1.currency = @"USD";
product1.orderPosition = @1;
product1.quantity = @1;

ABProduct* product2 = [[ABProduct alloc] init];
product2.idx = @"idx2";
product2.name = @"name2";
product2.price = @200;
product2.currency = @"USD";
product2.orderPosition = @2;
product2.quantity = @2;

ABInAppEvent* event = [[ABInAppEvent alloc] init];
[event setCategory:ABCategory.viewSearchResult];
[event setSemantics:@{
    ABSemanticsKey.products: @[
        product1.toDictionary,
        product2.toDictionary,
    ],
    ABSemanticsKey.query: @"query",
}];

[event send];

Add to Cart

1234567891011121314151617181920212223242526272829303132333435
#import <AirBridge/ABProduct.h>
#import <AirBridge/ABInAppEvent.h>
#import <AirBridge/ABCategory.h>
#import <AirBridge/ABSemanticsKey.h>

ABProduct* product1 = [[ABProduct alloc] init];
product1.idx = @"idx1";
product1.name = @"name1";
product1.price = @100;
product1.currency = @"USD";
product1.orderPosition = @1;
product1.quantity = @1;

ABProduct* product2 = [[ABProduct alloc] init];
product2.idx = @"idx2";
product2.name = @"name2";
product2.price = @200;
product2.currency = @"USD";
product2.orderPosition = @2;
product2.quantity = @2;

ABInAppEvent* event = [[ABInAppEvent alloc] init];
[event setCategory:ABCategory.addToCart];
[event setSemantics:@{
    ABSemanticsKey.products: @[
        product1.toDictionary,
        product2.toDictionary,
    ],
    ABSemanticsKey.cartID: @"cartID",
    ABSemanticsKey.currency: @"currency"
}];

[event setValue:@300];

[event send];

Order Complete

123456789101112131415161718192021222324252627282930313233343536
#import <AirBridge/ABProduct.h>
#import <AirBridge/ABInAppEvent.h>
#import <AirBridge/ABCategory.h>
#import <AirBridge/ABSemanticsKey.h>

ABProduct* product1 = [[ABProduct alloc] init];
product1.idx = @"coke_zero";
product1.name = @"Coke Zero";
product1.price = @100;
product1.currency = @"USD";
product1.orderPosition = @1;
product1.quantity = @1;

ABProduct* product2 = [[ABProduct alloc] init];
product2.idx = @"burger_cheese_double";
product2.name = @"Double Cheeseburger";
product2.price = @200;
product2.currency = @"USD";
product2.orderPosition = @2;
product2.quantity = @2;

ABInAppEvent* event = [[ABInAppEvent alloc] init];
[event setCategory:ABCategory.purchase];
[event setSemantics:@{
    ABSemanticsKey.products: @[
        product1.toDictionary,
        product2.toDictionary,
    ],
    ABSemanticsKey.transcationID: @"transcationID",
    ABSemanticsKey.currency: @"currency",
    ABSemanticsKey.inAppPurchased: @YES
}];

[event setValue:@300];

[event send];

Test Event Transmission

Make sure that the events are being properly sent through the SDK.

  1. Send an event with the SDK.

  2. Check if the event shows up at "Airbridge dashboard → Raw Data → App Real-time Logs".

Advanced Setup


Install Restricted SDK

Restricted SDK does not collect device IDs, including Ad ID. The restricted SDK will be available starting from v1.34.9.

Install using CocoaPods

1. Create the Podfile with the following command.

12
cd path/to/project
touch Podfile

2. Fill in the Podfile as follows.

Podfile
123
target '[Project Name]' do
    pod 'AirBridgeRestricted', '1.35.0'
end

Airbridge iOS SDK 1.18.0+ requires CocoaPods 1.11.0+

3. Open the terminal and enter the following command.

12
cd path/to/project
pod install --repo-update

When no pod command is found, install cocoapods with the below command.

  • sudo gem install cocoapods

Install without CocoaPods

AirBridge.framework(restricted) : Download

SDK Signature Setup

Protection against SDK spoofing is possible once you set up an SDK signature. Settings can be applied by calling setSDKSignatureSecret before the SDK initialization code.

123
[AirBridge setSDKSignatureSecretWithID: "YOUR_SDK_SIGNATURE_SECRET_ID", secret: "YOUR_SDK_SIGNATURE_SECRET"];

[AirBridge getInstance:@"YOUR_APP_TOKEN" appName:@"YOUR_APP_NAME" withLaunchOptions:launchOptions];

Please ask your CSM for the "SDK Signature Secret ID" and "SDK Signature Secret" values.

Hash User Information

email and phone information are hashed by default. (SHA256)
Call setIsUserInfoHashed at the beginning of the code that initializes the SDK to change this setting.

1234
// Disable user information hashing
[AirBridge setIsUserInfoHashed:NO];

[AirBridge getInstance:@"YOUR_APP_TOKEN" appName:@"YOUR_APP_NAME" withLaunchOptions:launchOptions];

Session Timeout

Call setSessionTimeout at the beginning of the code that initializes the SDK to change this setting.

  • Session timeout is in milliseconds and must range between 0 and 604800000 (7 days).

  • Default value is 1000 * 60 * 5 (5 minutes).

123
[AirBridge setSessionTimeout:1000 * 60 * 5];

[AirBridge getInstance:@"YOUR_APP_TOKEN" appName:@"YOUR_APP_NAME" withLaunchOptions:launchOptions];

Privacy Protection

Use this function if privacy laws apply, and data should only be collected and transferred with consent. (e.g GDPRCCPA)

If autoStartTrackingEnabled is set to NO (false) before the SDK initialization code, events will not be sent before the startTracking function is called. This includes events such as "deep link open".

12345
AirBridge.autoStartTrackingEnabled = NO;

[AirBridge getInstance:@"YOUR_APP_TOKEN" appName:@"YOUR_APP_NAME" withLaunchOptions:launchOptions];

[AirBridge startTracking];

The SDK will send all deep link events when the app is opened using a deep link.

If setIsTrackAirbridgeDeeplinkOnly is set as YES (true) at the beginning of the code that initializes the SDK, the SDK will only send deep link events that use "Airbridge deep links".

1234
// Send deeplink events only when application is opened with `Airbridge deeplinks`
[AirBridge setIsTrackAirbridgeDeeplinkOnly:YES];

[AirBridge getInstance:@"YOUR_APP_TOKEN" appName:@"YOUR_APP_NAME" withLaunchOptions:launchOptions];

The Airbridge SDK can track Facebook deferred App Links through the following settings.

  1. Install the Facebook SDK: https://developers.facebook.com/docs/ios/getting-started.

  2. Open ios/[Project name]/AppDelegate.

  3. Set setIsFacebookDeferredAppLinkEnabledto YES(true) at the beginning of the code that initializes the Airbridge SDK.

123
[AirBridge setIsFacebookDeferredAppLinkEnabled:YES];

[AirBridge getInstance:@"YOUR_APP_TOKEN" appName:@"YOUR_APP_NAME" withLaunchOptions:launchOptions];

Track Uninstall Event

Please refer to this page for more information on app uninstall tracking.

Use handleURLSchemeDeeplink to send the deep link event to the SDK when users click a push notification.

1234567891011121314151617181920212223
- (void)         application:(UIApplication *)application 
didReceiveRemoteNotification:(NSDictionary *)userInfo 
      fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler 
{
    if (UIApplication.sharedApplication.applicationState == UIApplicationStateInactive) {
        NSURL* url = // deeplink of push notification's payload
        
        [AirBridge.deeplink handleURLSchemeDeeplink:url];
    }
}

- (void)userNotificationCenter:(UNUserNotificationCenter *)center 
didReceiveNotificationResponse:(UNNotificationResponse *)response 
         withCompletionHandler:(void (^)(void))completionHandler API_AVAILABLE(ios(10.0)) 
{
    if (UIApplication.sharedApplication.applicationState == UIApplicationStateInactive
        && [response.actionIdentifier isEqual:UNNotificationDefaultActionIdentifier])
    {
        NSURL* url = // deeplink of push notification's payload
        
        [AirBridge.deeplink handleURLSchemeDeeplink:url];
    }
}

Track Authorize Timeout

When the AppTrackingTransparency.framework is used to present an app-tracking authorization request to the user, IDFA will not be collected when the install event occurs because the install event occurs before the selection.

If trackingAuthorizeTimeoutis called before the SDK initialization code, the install event will be sent after the timeoutperiod or delayed until an ATT option is selected.

trackingAuthorizeTimeoutis in milliseconds.

Install events can be delayed for as long as the trackingAuthorizeTimeoutperiod.

By default, trackingAuthorizeTimeoutis reset every time the App restarts. To prevent this, you can set isRestartTrackingAuthorizeTimeoutas NO or false.

A deferred deep link will be sent to DeeplinkCallback if ATT status is aprroved or a timeout occurs.

1234
AirBridge.setting.trackingAuthorizeTimeout = 30 * 1000;
AirBridge.setting.isRestartTrackingAuthorizeTimeout = NO;

[AirBridge getInstance:@"YOUR_APP_TOKEN" appName:@"YOUR_APP_NAME" withLaunchOptions:launchOptions];

Event Buffer Limit

When an event transmission failure occurs, the Airbridge SDK will store the event and retry at a later time. The following settings will allow you to limit the storage used for such events.

1234
// Event count limit
[AirBridge.setting setEventMaximumBufferCount:newValue]
// Event size limit (Byte)
[AirBridge.setting setEventMaximumBufferSize:newValue]

Attribution Result Callback Setup

Get attribution result data using the Airbridge SDK.

1234
AirBridge.setting().attributionCallback = { (attribution: [String : String]) in
    // Process attribution data...

}
  • Below is a list of data fields that will be retrieved through the callback.

Field

Description

attributedChannel

Channel (String)

attributedCampaign

Campaign (String)

attributedAdGroup

Ad Group (String)

attributedAdCreative

Ad Creative (String)

attributedContent

Content (String)

attributedTerm

Keyword (String)

attributedSubPublisher

Sub Publisher (String)

attributedSubSubPublisher1

Sub-sub Publisher 1 (String)

attributedSubSubPublisher2

Sub-sub Publisher 2 (String)

attributedSubSubPublisher3

Sub-sub Publisher 3 (String)

  • If the event is unattributed, below is an example of the response you'll get.

123
  {
    "attributedChannel": "unattributed"
  }

Guidelines for using attribution result data

  • Attribution data exists

  1. Attribution data is forwarded within 40 seconds of SDK initialization.

  2. If the app was closed and attribution data wasn't received, attribution data is forwarded within 40 seconds when the app is opened again.

  3. On very rare occasions, attribution data could take up to 5 minutes to be received.

  • Attribution data does not exist

  1. Attribution data will be received 3 hours after SDK initialization.

It is not recommended to utilize these attribution values for real-time processing

Track Life-Cycle Event Within Session

Airbridge doesn't track life-cycle event that occur within session timeout as default. You can track these events with below option.

1
[AirBridge.setting setTrackInSessionLifeCycleEventEnabled:YES];

DMA Compliance Setup

To comply with the Digital Markets Act (DMA), user consent must be shared with Airbridge. For detailed information about the DMA and the guidelines for advertisers, refer to this article.

Note that consent from all end users in the European Economic Area (EEA) should always be shared with Airbridge.

1. Confirm whether the end user launched the app in the EEA. If the end user did launch the app in the EEA (eea=1) and DMA applies, confirm whether the consent values are already stored for the session. If there are consent values stored, continue to Step 3.

If the end user launched the app from outside the EEA, it is not necessary to collect user consent.

Note

Airbridge cannot provide guidance on storing the consent values or the development and implementation of privacy prompts. For assistance, consult legal professionals.

2. If there are no consent values stored, proceed to obtain user consent, such as with a privacy prompt. You must collect the adPersonalization and adUserData values in this step.

3. Initialize the Airbridge SDK and share the consent values with Airbridge before collecting the end user’s personal data.

Attention

  • Use the field names specified by Airbridge: eea, adPersonalization, and adUserData.

  • Fill in 0 or 1 in accordance with the consent values collected.

1234567891011121314151617
// AppDelegate.swift
func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]?
) {
    AirBridge.setAutoStartTrackingEnabled(false)
    AirBridge.getInstance("YOUR_APP_TOKEN", appName:"YOUR_APP_NAME", withLaunchOptions:launchOptions)

    // Based on actual region
    AirBridge.state()?.UserAlias(withKey:"eea", value:"0" or "1")
    
    // Based on actual user consent
    AirBridge.state()?.UserAlias(withKey:"adPersonalization", value:"0" or "1")
    AirBridge.state()?.UserAlias(withKey:"adUserData", value:"0" or "1")
    
    AirBridge.startTracking()
}

Hybrid Application


While basic events (e.g. "install", "open", "deep link open") can be automatically tracked by only installing the iOS SDK in your hybrid app, in-app events (e.g. sign-up, purchase, etc.) cannot be tracked as they are actually in-browser events that occur within a website of the WebView environment. Airbridge provides a simpler way to track in-app events by enabling the iOS SDK to automatically pull all events from the web SDK that is installed on the website of the WebView environment. This replaces the hassle of having to create bridge functions between native and WebView environments.

Attention

Please note that in order to utilize this feature, both SDKs must be installed; Android SDK on the mobile native environment and web SDK on the website of the WebView environment.

Send WebView Environment Events

The Airbridge iOS SDK can send events instead of the Airbridge Web SDK installed on your WebView website.

Add Airbridge.webInterface under the WebView configuration controller.

12345678
WKWebViewConfiguration* configuration = [[WKWebViewConfiguration alloc] init];

WKUserContentController* controller = [[WKUserContentController alloc] init];
[AirBridge.webInterface injectTo:controller withWebToken:@"YOUR_WEB_TOKEN"];

configuration.userContentController = controller;
    
WKWebView* webview = [[WKWebView alloc] initWithFrame:CGRectZero configuration:configuration];

YOUR_WEB_TOKEN can be found at the "Airbridge dashboard → Settings → Tokens → Web SDK Token".

Troubleshooting


Webcredentials

If the app is using Autofill and no webcredentials are set, the application's autofill passwords are saved to applinks:YOUR_APP_NAME.airbridge.io or applinks:YOUR_APP_NAME.abr.ge.

Follow the steps below to change the location of where the passwords will be saved to. Change example.com to the domain you will be saving autofill passwords to.

1. Host the following JSON at https://example.com/.well-known/apple-app-site-association.

12345
{
    "webcredentials": {
        "apps": ["TEAM_ID.APP_BUNDLE_ID"]
    }
}

TEAM_ID.APP_BUNDLE_ID example: 9JA89QQLNQ.com.apple.wwdc

2. Go to "Xcode → Project file → Signing & Capabilities → Associated Domains".

3. Click "+" and add webcredentials:example.com.

Bitcode Compile Error

Airbridge iOS SDK v1.28.0+ no longer supports Bitcode. (Bitcode has been deprecated since Xcode 14)
This could lead to compile errors for the project if Bitcode is used.

Text
1
Textld: XCFrameworkIntermediates/AirBridge/AirBridge.framework/AirBridge(AirBridge-arm64-master.o)' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE)

Please add the following to your Podfile to prevent this.

Podfile
12345
installer.pods_project.targets.each do |target|
    target.build_configurations.each do |configuration|
        configuration.build_settings['ENABLE_BITCODE'] = 'NO'
    end
end

Or you can set "ENABLE_BITCODE" to "NO" in Xcode.

Please note that .ipa files using Bitcode are automatically deleted by the Appstore due to the Bitcode deprecation.

Issues with Building Using Xcode 13

Airbridge iOS SDK v1.28.0+ does not support Xcode 13, along with iOS 9 and iOS 10.
If the above Xcode/iOS needs to be supported, please use iOS SDK v1.27.0 and below.

Migration Guide

Before updating the SDK, please review the following information.

1.36.5

With support for the privacy manifest, the Static Library has been changed to a Dynamic Library. If you are installing directly, change Airbridge.xcframework to Embed Without Signing in Project's [General]>[Frameworks, Libraries, and Embedded Content].

Was this page helpful?

Have any questions or suggestions?