DeepLink - iOS SDK

Install the Airbridge iOS SDK and implement the necessary settings following the steps below.

Install SDK

The Airbridge iOS SDK can be installed using the method below. After installation, you can verify whether the SDK has been properly installed through the iOS SDK Test.

1. Navigate to [File]>[Add Packages...] in Xcode.

2. Enter the following address into the search bar and click Add Package.

3. Click Add Package again.

4. The Airbridge iOS SDK will be added to Package Dependencies.

5. Add the framework corresponding to the dependency of SDK to the project. Navigate to [Project File]>[General]>[Frameworks, Libraries, and Embedded Content] in Xcode and click +.

6. Add all the frameworks below. Set the Embed of the added frameworks to "Do not Embed." Then, navigate to [Project File]>[Build Phase]>[Link Binary With Libraries] in the Xcode and set the Status to "Optional."

Attention

Before installing the iOS SDK, navigate to [YOUR_PROJECT]>[Build Settings] in your Xcode and make sure to set the User Script Sandboxing to "No." For more details, refer to the CocoaPods document.

1. Install CocoaPods with brew install cocoapods.

2. Create a Podfile with pod init.

3. Add the SDK as a dependency with the code below in the Podfile. Check the latest SDK version from this page and replace $HERE_LATEST_VERSION with the latest version number.

Podfile
target '[Project Name]' do ... # Replace $HERE_LATEST_VERSION with latest version # - Versions: https://help.airbridge.io/developers/release-note-ios-sdk # - Example: pod 'airbridge-ios-sdk', '4.X.X' pod 'airbridge-ios-sdk', '$HERE_LATEST_VERSION' ...end

4. The installation will start when you enter pod install --repo-update.

5. Run YOUR_PROJECT.xcworkspace to verify that the Airbridge iOS SDK is successfully installed.

Attention

You cannot install the Airbridge iOS SDK with Tuist's XcodeProj-based integration. Make sure to install the iOS SDK through Xcode's default integration.

1. Run the tuist edit command.

2. Add remote to project.packages. Add SDK as package to project.targets[...].target.dependencies and the dependency framework as sdk. Then Check the latest SDK version from this page and replace $HERE_LATEST_VERSION with the latest version number. For the dependency framework list, refer to the table below.

import ProjectDescription let project = Project( packages: [ .remote( url: "https://github.com/ab180/airbridge-ios-sdk-deployment", // Replace $HERE_LATEST_VERSION with latest version // - Versions: https://help.airbridge.io/developers/release-note-ios-sdk // - Example: requirement: .exact(from: "4.X.X") requirement: .exact(from: "$HERE_LATEST_VERSION") ), ... ], targets: [ .target( dependencies: [ .package(product: "Airbridge", type: .runtime), .sdk(name: "AdSupport", type: .framework, status: .optional), .sdk(name: "AdServices", type: .framework, status: .optional), .sdk(name: "CoreTelephony", type: .framework, status: .optional), .sdk(name: "StoreKit", type: .framework, status: .optional), .sdk(name: "AppTrackingTransparency", type: .framework, status: .optional), .sdk(name: "WebKit", type: .framework, status: .optional), ... ] ), ... ], ...)

3. Run the tuist generate command.

4. Airbridge is added to the Package Dependencies in Xcode.

1. Download the Airbridge iOS SDK from the link below.

2. Add Airbridge.xcframework to your project. Navigate to [Project File]>[General]>[Frameworks, Libraries, and Embedded Content] in Xcode and click +.

3. Click Add Files... under [Add Other...] and select Airbridge.xcframework.

4. Set the Embed of Airbridge.xcframework to "Embed & Sign".

5. Add the framework corresponding to the dependency of SDK to the project. Navigate to [Project File]>[General]>[Frameworks, Libraries, and Embedded Content] in Xcode and click +.

6. Add all the frameworks below. Set the Embed of the added frameworks to "Do not Embed." Then, navigate to [Project File]>[Build Phase]>[Link Binary With Libraries] in the Xcode and set the Status to "Optional."

Install Restricted SDK

Note

Install only one version of the SDK, either the general SDK or the restricted SDK.

Depending on policies and environments, restrictions on collecting device IDs like GAID and IDFA may be required. When installing the Restricted SDK version, the device IDs are not collected.

Install the Restricted SDK using the method below.

1. Navigate to [File]>[Add Packages...] in Xcode.

2. Enter the following address into the search bar and click Add Package.

3. Click Add Package again.

4. The Airbridge iOS SDK will be added to Package Dependencies.

5. Add the framework corresponding to the dependency of SDK to the project. Navigate to [Project File]>[General]>[Frameworks, Libraries, and Embedded Content] in Xcode and click +.

6. Add all the frameworks below. Set the Embed of the added frameworks to "Do not Embed." Then, navigate to [Project File]>[Build Phase]>[Link Binary With Libraries] in the Xcode and set the Status to "Optional."

Attention

Before installing the iOS SDK, navigate to [YOUR_PROJECT]>[Build Settings] in your Xcode and make sure to set the User Script Sandboxing to "No." For more details, refer to the CocoaPods document.

1. Install CocoaPods with brew install cocoapods.

2. Create a Podfile with pod init.

3. Add the SDK as a dependency with the code below in the Podfile. Check the latest SDK version from this page and replace $HERE_LATEST_VERSION with the latest version number.

Podfile
target '[Project Name]' do ... # Replace $HERE_LATEST_VERSION with latest version # - Versions: https://help.airbridge.io/developers/release-note-ios-sdk # - Example: pod 'airbridge-ios-sdk-restricted', '4.X.X' pod 'airbridge-ios-sdk-restricted', '$HERE_LATEST_VERSION' ...end

4. The installation will start when you enter pod install --repo-update.

5. Run YOUR_PROJECT.xcworkspace to verify that the Airbridge iOS SDK is successfully installed.

Attention

You cannot install the Airbridge iOS SDK with Tuist's XcodeProj-based integration. Make sure to install the iOS SDK through Xcode's default integration.

1. Run the tuist edit command.

2. Add remote to project.packages. Add the package to project.targets [...].target.dependencies. Refer to the code below.

Add remote to project.packages. Add SDK as package to project.targets[...].target.dependencies and the dependency framework as sdk. Then Check the latest SDK version from this page and replace $HERE_LATEST_VERSION with the latest version number. For the dependency framework list, refer to the table below.

import ProjectDescription let project = Project( packages: [ .remote( url: "https://github.com/ab180/airbridge-ios-sdk-restricted-deployment", // Replace $HERE_LATEST_VERSION with latest version // - Versions: https://help.airbridge.io/developers/release-note-ios-sdk // - Example: requirement: .exact(from: "4.X.X") requirement: .exact(from: "$HERE_LATEST_VERSION") ), ... ], targets: [ .target( dependencies: [ .package(product: "Airbridge", type: .runtime), .sdk(name: "AdServices", type: .framework, status: .optional), .sdk(name: "CoreTelephony", type: .framework, status: .optional), .sdk(name: "StoreKit", type: .framework, status: .optional), .sdk(name: "WebKit", type: .framework, status: .optional), ... ] ), ... ], ...)

3. Run the tuist generate command.

4. Airbridge is added to the Package Dependencies in Xcode.

1. Download the Airbridge iOS SDK from the link below.

2. Add Airbridge.xcframework to your project. Navigate to [Project File]>[General]>[Frameworks, Libraries, and Embedded Content] in Xcode and click +.

3. Click Add Files... under [Add Other...] and select Airbridge.xcframework.

4. Set the Embed of Airbridge.xcframework to "Embed & Sign".

5. Add the framework corresponding to the dependency of SDK to the project. Navigate to [Project File]>[General]>[Frameworks, Libraries, and Embedded Content] in Xcode and click +.

6. Add all the frameworks below. Set the Embed of the added frameworks to "Do not Embed." Then, navigate to [Project File]>[Build Phase]>[Link Binary With Libraries] in the Xcode and set the Status to "Optional."

Initialize SDK

SDK initialization methods vary depending on the system architecture. For SceneDelegate Lifecycle or AppDelegate Lifecycle, refer to the method for AppDelegate. For SwiftUI Lifecycle, refer to the method for SwiftUI.

The YOUR_APP_NAME and YOUR_APP_SDK_TOKEN can be found on the [Settings]>[Tokens] page in the Airbridge dashboard.

Call the Airbridge.initializeSDK function at the very top of AppDelegate's application(_:didFinishLaunchingWithOptions:) function.

import UIKitimport Airbridge @mainclass AppDelegate: UIResponder, UIApplicationDelegate { func application( _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { let option = AirbridgeOptionBuilder(name: "YOUR_APP_NAME", token: "YOUR_APP_SDK_TOKEN") .build() Airbridge.initializeSDK(option: option) return true }}

Attention

Make sure that the Airbridge.initalizeSDK function is called within the application(_:didFinishLaunchingWithOptions:) of the AppDelegate for proper functionality.

Call the Airbridge.initializeSDK function at the very top of AppDelegate's application(_:didFinishLaunchingWithOptions:) function.

#import "AppDelegate.h"#import <Airbridge/Airbridge.h> @interface AppDelegate () @end @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { AirbridgeOptionBuilder* optionBuilder = [[AirbridgeOptionBuilder alloc] initWithName:@"YOUR_APP_NAME" token:@"YOUR_APP_SDK_TOKEN"]; AirbridgeOption* option = [optionBuilder build]; [Airbridge initializeSDKWithOption:option]; return YES;} @end

Attention

Make sure that the Airbridge.initalizeSDK function is called within the application(_:didFinishLaunchingWithOptions:) of the AppDelegate for proper functionality.

Call the Airbridge.initializeSDK function at the top of init.

import SwiftUIimport Airbridge @mainstruct ExampleApp: App { init() { let option = AirbridgeOptionBuilder(name: "YOUR_APP_NAME", token: "YOUR_APP_SDK_TOKEN") .build() Airbridge.initializeSDK(option: option) } var body: some Scene { WindowGroup { ContentView() } }}

Attention

Make sure that the Airbridge.initalizeSDK function is called within the init of the App for proper functionality.

Attention

The SwiftUI Lifecycle method does not provide a Referrer URL, so the Organic Referrer Attribution cannot be used. Even with the use of UIApplicationDelegateAdaptor, the Organic Referrer Attribution cannot be used in the SwiftUI Lifecycle method.

Configure ATT Prompt

Note

The functions necessary to ensure compliance with privacy policies should be reviewed with legal counsel.

The IDFA can only be collected if users consent to data tracking via the App Tracking Transparency (ATT) prompt.

Event collection should be delayed until the user allows tracking. If the install event is collected before the user allows tracking on the ATT prompt, the install event data will lack an identifier, making performance measurement difficult. We recommend setting a sufficient delay time for event collection to collect identifiers.

1. Prepare the text you will use in the ATT prompt.

2. Enter the prepared text in the NSUserTrackingUsageDescription key of the Info.plist file.

  1. Navigate to [YOUR_PROJECT]>[Info]>[Custom iOS Target Properties] in Xcode.

  2. Hover your mouse over the key items, click + that appears, and enter Privacy - Tracking Usage Description.

  3. Enter the text for the ATT prompt as value.

1. Run the tuist edit command.

2. Enter NSUserTrackingUsageDescription as key to .extendingDefault in project.targets[...].infoPlist.

3. Enter the text for the ATT prompt as value.

import ProjectDescription let project = Project( targets: [ .target( infoPlist: .extendingDefault( with: [ "NSUserTrackingUsageDescription": "YOUR_DESCRIPTION", ... ] ), ... ), ... ] ...)

3. Set the point of time for displaying the ATT prompt on the app.

4. If the install event is not collected, the Airbridge iOS SDK delays collecting install events for 30 seconds until the user allows tracking each time the app is launched. If the user exits the app before deciding whether to allow tracking, the SDK will not collect the install event and will try again at the next app launch.

When using the DeepLink Plan, it is recommended that the setAutoDetermineTrackingAuthorizationTimeout parameter be set to 0 seconds when configuring the ATT prompt.

As the DeepLink Plan does not support attribution using identifiers, the setAutoDetermineTrackingAuthorizationTimeout parameter should be set to 0 seconds to seamlessly redirect users who have already installed the app to the intended in-app location as configured in the deferred deep link.

The autoDetermineTrackingAuthorizationTimeoutfunction can be used to set a sufficient delay before event collection. The default setting is 30 seconds and can be set to up to 3600 seconds (1 hour).

import Airbridge...let option = AirbridgeOptionBuilder(name: "YOUR_APP_NAME", token: "YOUR_APP_SDK_TOKEN") .setAutoDetermineTrackingAuthorizationTimeout(second: 30) .build()Airbridge.initializeSDK(option: option)

Attention

Set a sufficient delay time to collect the app install event. If the SDK collects install events before users can allow tracking on the ATT prompt, the IDFA won't be collected along with the install events.

Deep Linking

Deep linking allows you to redirect users from ads to specific locations within your app. The data collected from the tracking link enables you to monitor the performance of the deep link in Airbridge.

When a user clicks on the Airbridge tracking link, the scheme deep link embedded in the tracking link is converted into an Airbridge Deep Link, which can be either an HTTP deep link or a scheme deep link. This Airbridge Deep Link redirects the user to the desired app location. Then, the Airbridge SDK converts the Airbridge Deep Link back to the original scheme deep link embedded in the tracking link and passes it to the app.

  • Example scheme deep link embedded in the tracking link: YOUR_SCHEME://product/12345

  • Examples of Airbridge Deep Links

    • HTTP deep link format 1: https://YOUR_APP_NAME.airbridge.io/~~~

    • HTTP deep link format 2: https://YOUR_APP_NAME.abr.ge/~~~

    • Scheme deep link format: YOUR_SCHEME://product/12345?airbridge_referrer=~~~

When the app is installed on the device and the tracking link is clicked, the app opens through the Airbridge Deep Link. The Airbridge SDK converts the Airbridge Deep Link into the scheme deep embedded in the tracking link and passes it to the app.

When the app is not installed on the device and the tracking link is clicked, the Airbridge SDK saves the Airbridge Deep Link. After the user is redirected to the app store or website and the app is installed and launched, the Airbridge SDK converts the saved Airbridge Deep Link into the scheme deep link embedded in the tracking link and passes it to the app.

Set up deep linking

For the deep linking setup, the following information is required.

  • Deep link information submitted in the Airbridge dashboard

  • In-app location address for user redirection

First, enter the deep link information into the Airbridge dashboard.

After entering the deep link information into the Airbridge dashboard, an additional setup is required to enable the following.

  • App launch with Airbridge Deep Links

  • User redirection with Airbridge Deep Links

For detailed instructions, refer to the information below.

Set up deferred deep linking

When a user clicks on a tracking link with deferred deep linking capabilities and your app is not installed on the device, the Airbridge SDK collects the deep link as follows.

The Airbridge.handleDeferredDeeplink function retrieves the saved Airbridge deep link and converts it into a scheme deep link to pass it to the app. Users are redirected to the intended destination using the converted scheme deep link.

import Airbridge...let option = AirbridgeOptionBuilder(name: "YOUR_APP_NAME", token: "YOUR_APP_SDK_TOKEN") .build()Airbridge.initializeSDK(option: option)...let isFirstCalled = Airbridge.handleDeferredDeeplink() { url in // when handleDeferredDeeplink is called firstly after install if let url { // show proper content using url (YOUR_SCHEME://...) }}

The Airbridge.handleDeferredDeeplink function returns true if the app is installed and called for the first time, waits for the Airbridge deep link acquisition, and converts it to a scheme deep link to pass it to onSuccess. You can use this scheme deep link to send users to the set destination.

If there is no stored Airbridge deep link, it will deliver nil to onSuccess. If the SDK is not initialized or if the Airbridge.handleDeferredDeeplink function has not been called for the first time, it will return false.

The scheme deep link delivered is generally in the format of YOUR_SCHEME://... URL. If you use services like Meta Deferred App Links, it may be delivers in a different format.

Attention

When the app is opened via a deep link, Airbridge passes null to onSuccess regardless of whether a deferred deep link exists or not, ensuring that only the deep link is processed.

Testing

The SDK functionality test and deep link test allow you to check whether the SDK and deep linking work as intended.

Test SDK functionality

Check whether the Airbridge iOS SDK is operating properly. The Install events are collected by the Android SDK regardless of whether the additional configurations have been completed or not.

Check Install event collection

Follow the steps below to check whether the Install events are being collected by the iOS SDK.

1. Prepare a test device where the app is not installed, or if the app is already installed, delete it before testing.

2. Set the SDK log level to debug.

let option = AirbridgeOptionBuilder(name: "YOUR_APP_NAME", token: "YOUR_APP_SDK_TOKEN") .setLogLevel(.debug) .build()Airbridge.initializeSDK(option: option)

3. Install the app on the test device. After installing the app, launch it so that the Install event is collected.

The first Open event collected by Airbridge is recorded as an Install event. Therefore, the Open may not be recorded when the app install event is collected.

4. In the Xcode Console, check whether the event performed on the test device with a specific IDFA is logged properly. In the Console Filter, enter Library:Airbridge. If the Install events are being collected properly, you should see logs such as the following.

  • Send event packets to Airbridge: categories=9161

  • Send event packets to Airbridge: categories=9163

For the Xcode Console messages and their meaning, refer to the following.

5. If you can't see the logs in the Xcode Console even after a sufficient amount of time has passed, check whether the SDK has been initialized, the SDK configurations are completed as instructed, and the network status is stable.

If the problem persists, contact your Airbridge CSM and share your SDK logs. If you don't have a designated Airbridge CSM, contact the Airbridge Help Center.

The deep linking test is available in the [Deep Linking] tab on the [Settings]>[Test Console] page in the Airbridge dashboard.

Pre-setup

Before testing the deep link, make sure the following items have been set up.

Test preparation

The deep link information and app information required to enable deep linking must be submitted to the Airbridge dashboard before starting the test. This stage won’t show in your dashboard if the deep link information and app information have already been submitted. You may move on to the actual testing.

To test deep linking, make sure the required deep link information is submitted to the Airbridge dashboard for at least 1 platform. If you want to add or edit the deep link info, click Go to Settings. You can check and update the information on the [Tracking Link]>[Deep Links] page. For more details, refer to this article.

Refresh to see the latest version

If you've completed the setup in a different browser tab, refresh the Airbridge dashboard tab to reflect the most recent changes.

Submit App Info

The deep link fallback path should be configured in advance so that users who haven’t installed the app on their devices are redirected to the app store. Click Go to Settings and fill in the “Platform” section on the [Settings]>[App Settings] page. For more details, refer to this article.

Enter the deep link configured for the app you want to test. The deep link must be in the form of the URL scheme deep link. It should preferably be set to a specific in-app location instead of the home screen.

Attention

Encode the deep link before entering it into the required field. If you don't, the link will not conform to the standard URL format, and deep linking will not function properly.

Click the [switch] icon on the right to change the input method. This allows you to add the path and parameters separately to input a deep link.

Check readiness for testing

Check if the info required for testing deep linking is submitted to the Airbridge dashboard. If all info is submitted for a platform, the “Ready for testing” tag will show. If not, the “Info incomplete” tag will show. Click the tooltip next to the platform name to see the required info for testing. If you see the “Info incomplete” tag for the platform you want to run the deep linking test, click Go to Settings to add or edit the required info to get ready for testing.

Refresh to see the latest version

If you've completed the setup in a different browser tab, refresh the Airbridge dashboard tab to reflect the most recent changes.

Testing

The testing console offers tests for 2 deep-linking scenarios. There are 3 tests for “Scenario 1: App already installed” and 1 test for “Scenario 2: App not installed." Complete all 4 tests if you are using a custom domain to create tracking links. If not, complete all tests except for the Custom Domain Test.

Why are there multiple tests?

Airbridge supports various deep linking methods, including URL scheme deep links, Universal Links, and App Links. When an app is launched, the system automatically selects the most suitable method based on factors such as the operating system, browser, and whether the app is installed. Test across all possible cases to ensure reliable deep-linking performance.

Testing for Scenario 1: App already installed

Testing Scenario 1 allows you to make sure the deep linking functions as intended for users who have already installed the app on their devices. You can run 3 types of tests, including a test for cases when the app is opened via URL scheme deep links, when the app is opened via Universal Links or App Links, and when the tracking link is created using a custom domain.

Preparation

Before you start the test, check the following items.

1. Prepare a mobile test device.

2. Check whether the app is installed on the test device. If not, download the app.

3. Open the app at least once after download.

4. Make sure the default browser setting is Chrome or Safari. The deep linking test may not work in other browsers.

5. Make sure you have a stable network connection.

Note

If there are no issues with the deep link settings and the deep linking tests have been successfully completed, Airbridge deep linking works on most browsers. Note that deep linking tests are only supported on Chrome and Safari.

How to run each test

1. Click the test you want to run.

2. Scan the QR code with the test device and access the testing page. If you're unable to scan the QR code, use the URL at the bottom of the QR code.

3. Once you access the testing website, click Trigger deep linking. The test will run automatically on the 5 items displayed. If an issue is identified, follow the instructions and refer to the Airbridge user guide to resolve it. Then, start the test again.

When the test is completed successfully, you can find the Deeplink Open event on the [Raw Data]>[App Real-time Log] page.

4. After returning to the [Testing Console] tab, click Done and close the test window.

Testing for Scenario 2: App not installed

Testing Scenario 2 allows you to make sure the deep linking functions as intended for users who have not installed the app on their devices. You can run 1 test for deferred deep linking.

Preparation

Before you start the test, check the following items.

1. Prepare a mobile test device.

2. Check whether the app is not installed on the test device. If installed, delete the app from the device.

3. Make sure the default browser setting is Chrome or Safari. The deep linking test may not work in other browsers.

4. Make sure you have a stable network connection.

How to run the test

1. Click the test you want to run.

2. Scan the QR code with the test device and access the testing page. If you're unable to scan the QR code, use the URL at the bottom of the QR code.

3. Once you access the testing page, click Trigger deep linking. The test will run automatically on the 3 items displayed. If an issue is identified, follow the instructions and refer to the Airbridge user guide to resolve it.

When the test is completed successfully, you can find the Deeplink Open event on the [Raw Data]>[App Real-time Log] page.

4. After returning to the [Testing Console] tab, click Done and close the test window.

Troubleshooting

Refer to the information below for troubleshooting regarding deep links.

Additional SDK Settings

Follow the instructions below for additional setup.

Attention

Optional settings. Configure only if necessary.

Attention

Airbridge iOS SDK v.4.0.0 or later is required.

Tracking links are links that are embedded to ads for data collection. When users click on the ad, the tracking link is used to pass the touchpoint data to Airbridge, allowing for ad attribution.

Also, users who click on the ad with a tracking link can be redirected to a specific destination.

Use the createTrackingLink function to create tracking links. Refer to the code examples and the parameter details below.

public static func createTrackingLink( channel: String, option: [String: Any], onSuccess: @escaping (AirbridgeTrackingLink) -> Void) public static func createTrackingLink( channel: String, option: [String: Any], onSuccess: @escaping (AirbridgeTrackingLink) -> Void, onFailure: @escaping (Error) -> Void)

Use the option parameter in the createTrackingLink function to configure tracking link options.

Use the onSuccess callback in the createTrackingLink function to pass the AirbridgeTrackingLink.

public final class AirbridgeTrackingLink: NSObject { public let shortURL: URL public let qrcodeURL: URL}

Refer to the example codes below.