Install the Airbridge React Native SDK and implement the necessary settings following the steps below.
The Airbridge React Native SDK can be installed using the method below. After installation, you can verify whether the SDK has been properly installed through testing.
1. Use npm to install the airbridge-react-native-sdk.
npm install airbridge-react-native-sdk
2. Use CocoaPods to install the iOS dependency. The Android dependency is installed automatically.
cd ios; pod install
Attention
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. Use npm to install airbridge-react-native-sdk-restricted.
npm install airbridge-react-native-sdk-restricted
2. Use CocoaPods to install the iOS dependency. The Android dependency is installed automatically.
cd ios; pod install
The initialization methods for iOS and Android are different. Refer to the methods described below.
Note that the YOUR_APP_NAME and YOUR_APP_SDK_TOKEN can be found on the [Settings]>[Tokens] page in the Airbridge dashboard.
Add the following code to the ios/YOUR_PROJECT_NAME/AppDelegate.m
file.
import AirbridgeReactNative
...
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
AirbridgeReactNative.initializeSDK(name: "YOUR_APP_NAME", token:"YOUR_APP_SDK_TOKEN")
...
}
#import <AirbridgeReactNative/AirbridgeReactNative.h>
...
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[AirbridgeReactNative initializeSDKWithName:@"YOUR_APP_NAME" token:@"YOUR_APP_SDK_TOKEN"];
...
}
Add the following code to the android/app/src/main/java/.../MainApplication.kt
file.
import co.ab180.airbridge.reactnative.AirbridgeRN;
...
override fun onCreate() {
super.onCreate()
AirbridgeReactNative.initializeSDK(this, "YOUR_APP_NAME", "YOUR_APP_SDK_TOKEN")
...
}
import co.ab180.airbridge.reactnative.AirbridgeRN;
...
@Override
public void onCreate() {
super.onCreate();
AirbridgeReactNative.initializeSDK(this, "YOUR_APP_NAME", "YOUR_APP_SDK_TOKEN");
...
}
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 Airbridge generates a tracking link, it automatically selects and utilizes the optimal Airbridge deep link, depending on the environment.
Example)
Airbridge Deeplink: https://YOUR_APP_NAME.airbridge.io/~~~
Scheme Deeplink: YOUR_SCHEME://product/12345
When the app is installed on a device and the user clicks the tracking link, the app opens through the Airbridge deep link. The Airbridge SDK converts the Airbridge deep link into a scheme deep link set on the tracking link. The converted scheme deep link is sent to the app.
When the app is not installed on a device and the user clicks the tracking link, the Airbridge deep link is saved. After the user moves to the app store or website and the app is installed and launched, the Airbridge SDK converts the saved Airbridge deep link into a scheme deep link. The converted scheme deep link is sent to the app.
For the deep linking setup, the deep link information entered to the Airbridge dashboard and the in-app location address for user redirection is required.
First, enter the deep link information into the Airbridge dashboard.
For the deep linking setup, the following information must be entered into the Airbridge dashboard.
iOS URI scheme: The Airbridge deep link is converted to a scheme deep link using the iOS URI scheme.
iOS App ID: The universal link domain of the Airbridge deep link is set using the iOS App ID.
Android URI scheme: The Airbridge deep link is converted to a schema deep link using the Android URI scheme. This information is necessary for the App Link and URI scheme.
Package name: This is the Android app identifier necessary for the App Link and URI scheme.
Android sha256_cert_fingerprints: This is used for setting the App Link domain. This information is necessary for the App Link.
Attention
To properly redirect users as intended, submit different information for the production app and the development app.
Follow the steps below to enter the above information into the Airbridge dashboard.
1. Go to [Tracking Link]>[Deep Links] in the Airbridge dashboard.
2. Enter the iOS URI scheme in the iOS URI Scheme field. Include ://
. For example, if the iOS URI scheme is demo
, you enter it as demo://
.
3. In the Apple Developer Dashboard, go to [Identifier] of the app you want to set up the deep link. Find the App ID Prefix and Bundle ID.
4. The iOS App ID is in the format of App ID Prefix+ .+ Bundle ID
. Enter the iOS App ID into the iOS App ID field. For example, if the App ID Prefix is prefix
and the Bundle ID is example
, the iOS App ID is prefix.example
.
1. Go to [Tracking Link]>[Deep Links] in the Airbridge dashboard.
2. Enter the Android URI scheme into the Android URI Scheme field. Include ://
. For example, if the URI scheme is demo
, you must enter it as demo://
.
3. Enter the package name in the Package name field.
4. You need to find the sha256_cert_fingerprints. Run the following command from the keystore file you are deploying.
keytool -list -v -keystore YOUR_KEYSTORE.keystore
Find the SHA256 value in the results. The SHA256 value is the sha256_cert_fingerprints.
Certificate fingerprints:
MD5: 4C:65:04:52:F0:3F:F8:65:08:D3:71:86:FC:EF:C3:49
SHA1: C8:BF:B7:B8:94:EA:5D:9D:38:59:FE:99:63:ED:47:B2:D9:5A:4E:CC
SHA256: B5:EF:4D:F9:DC:95:E6:9B:F3:9A:5E:E9:D6:E0:D8:F6:7B:AB:79:C8:78:67:34:D9:A7:01:AB:6A:86:01:0E:99
5. Enter the SHA256 value into the sha256_cert_fingerprints field.
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
Airbridge deep link event collection
User redirection with Airbridge deep links
For detailed instructions, refer to the information below.
Configure the app to launch with an Airbridge deep link when the user clicks on a tracking link.
1. To set up the scheme deep link to your app, go to [YOUR_PROJECT]>[Info]>[URL Types] in Xcode.
2. Click + and enter the iOS URI scheme you submitted in the Airbridge dashboard in the URL Schemes field.
Attention
When entering the iOS URL scheme, exclude
://
.
3. To set up the universal link to your app, go to [YOUR_PROJECT]>[Signing & Capabilities] in Xcode.
4. Click + Capability to add Associated Domains.
5. Add applinks:YOUR_APP_NAME.airbridge.io
and applinks:YOUR_APP_NAME.abr.ge
to Associated Domains.
YOUR_APP_NAME is the Airbridge app name.
Attention
If you are using or plan to use the Password AutoFill feature, you must add the Webcredentials domain. A situation may arise where the domain of the password saved through the Password AutoFill feature appears as airbridge.io or abr.ge to your app users.
Refer to thisarticle for more details.
1. To set up the scheme deep link to your app, add an intent filter to the Activity that handles deep links in the AndroidManifest.xml
.
The intent filter you add must use the Android URI Scheme you entered into the Airbridge dashboard.
<activity ...>
...
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="YOUR_SCHEME" />
</intent-filter>
...
</activity>
Attention
When entering the Android URI Scheme, exclude
://
.
2. To set up the App Links to your app, add an intent filter under the Activity that handles the deep link in the AndroidManifest.xml
.
YOUR_APP_NAME
is the Airbridge app name.
<activity ...>
...
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" android:host="YOUR_APP_NAME.abr.ge" />
<data android:scheme="https" android:host="YOUR_APP_NAME.abr.ge" />
</intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" android:host="YOUR_APP_NAME.airbridge.io" />
<data android:scheme="https" android:host="YOUR_APP_NAME.airbridge.io" />
</intent-filter>
...
</activity>
The Airbridge.trackDeeplink function at the top of the OS callback should be called to pass the deep link events to the Airbridge SDK.
Add the following code snippet to the ios/YOUR_PROJECT_NAME/AppDelegate.m
file.
#import <AirbridgeReactNative/AirbridgeReactNative.h>
...
// when app is opened with scheme deeplink
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
// track deeplink
[AirbridgeReactNative trackDeeplinkWithUrl:url];
return YES;
}
...
// when app is opened with universal links
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler {
// track deeplink
[AirbridgeReactNative trackDeeplinkWithUserActivity:userActivity];
return YES;
}
import AirbridgeReactNative
...
// when app is opened with scheme deeplink
func application(
_ app: UIApplication,
open url: URL,
options: [UIApplication.OpenURLOptionsKey : Any] = [:]
) -> Bool {
// track deeplink
AirbridgeReactNative.trackDeeplink(url: url)
return true
}
...
// when app is opened with universal links
func application(
_ application: UIApplication,
continue userActivity: NSUserActivity,
restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void
) -> Bool {
// track deeplink
AirbridgeReactNative.trackDeeplink(userActivity: userActivity)
return true
}
Add the following code snippet to the android/app/src/main/java/.../MainActivity.kt
file.
import co.ab180.airbridge.reactnative.AirbridgeReactNative
...
override fun onResume() {
super.onResume()
AirbridgeReactNative.trackDeeplink(intent)
}
...
override fun onNewIntent(intent: Intent?) {
super.onNewIntent(intent)
setIntent(intent)
}
import co.ab180.airbridge.reactnative.AirbridgeReactNative;
...
@Override
protected void onResume() {
super.onResume();
AirbridgeReactNative.trackDeeplink(intent);
}
...
@Override
public void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(intent);
}
When an Airbridge deep link is executed, it is converted to a scheme deep link and passed to the OnDeeplinkReceived
callback. If a deep link from a different platform other than Airbridge is executed, it is passed to the callback without being converted.
The collected deep link is used to redirect the user to the intended destination.
import { Airbridge } from 'airbridge-react-native-sdk'
...
Airbridge.setOnDeeplinkReceived((url) => {
// show proper content using url
})
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 retrieves the deep link as follows.
The Airbridge SDK attempts to collect a deep link after initializing the SDK when all the following conditions are met. If the app is closed during collection, the Airbridge SDK treats it as if there is no stored Airbridge deep link.
The Airbridge.startTracking
function is called with the opt-in settings in place. Or, opt-in has not been set.
The ATT tracking response has been determined. Or, the event collection delay time set in the ATT prompt has expired.
Deferred deep links are automatically passed to OnDeeplinkReceived
, so no additional setup is required.
The SDK functionality test and deep link test allow you to check whether the SDK and deep linking work as intended.
Was this page helpful?