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
提示
请根据需求选择 General SDK 或 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.AirbridgeReactNative
...
override fun onCreate() {
super.onCreate()
AirbridgeReactNative.initializeSDK(this, "YOUR_APP_NAME", "YOUR_APP_SDK_TOKEN")
...
}
import co.ab180.airbridge.reactnative.AirbridgeReactNative;
...
@Override
public void onCreate() {
super.onCreate();
AirbridgeReactNative.initializeSDK(this, "YOUR_APP_NAME", "YOUR_APP_SDK_TOKEN");
...
}
Configure the SDK settings to use the Airbridge React Native SDK.
{
"autoDetermineTrackingAuthorizationTimeoutInSecond": number,
"isHandleAirbridgeDeeplinkOnly" : boolean
}
1. Create an airbridge.json file at the top level of the React Native project folder, input the JSON as above, and configure the SDK settings.
2. Don't input values for keys that are not necessary for your service.
Refer to the links below for detailed guidance on the individual key values.
Key Value | Reference |
---|---|
autoDetermineTrackingAuthorizationTimeoutInSecond | |
isHandleAirbridgeDeeplinkOnly |
提示
为确保遵守隐私政策所需的功能,应与法律顾问共同审查。
In the iOS environment, the IDFA can only be collected when users provide consent for data tracking through the AppTrackingTransparency (ATT) prompt.
Event collection should be delayed until the user allows tracking. If the install event is collected before the user allows tracking through 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. Provide the ATT prompt following this guide provided by Apple.
3. If the install event is not collected, the Airbridge React Native 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.
In the SDK settings, configure the autoDetermineTrackingAuthorizationTimeout
to set a sufficient delay time for collecting install events. The default value is 300 seconds, and it can be set up to 3600 seconds (1 hour).
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.
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 is saved. 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 embedded in the tracking link and passes it 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 scheme 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 submit the necessary information to the Airbridge dashboard.
1. Navigate 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
, enter demo://
.
3. In the Apple Developer Dashboard, navigate 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. Navigate 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
, enter 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.
Perform the following setup to enable app launch with Airbridge Deep Links after the user clicks on a tracking link.
1. For the scheme deep link setup, navigate to [YOUR_PROJECT]>[Info]>[URL Types] in Xcode.
2. Click + and enter the iOS URI scheme you submitted to the Airbridge dashboard into the URL Schemes field.
Attention
When entering the iOS URL scheme, exclude
://
.
3. For the Universal Link setup, 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. For the scheme deep link setup, 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 submitted to 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. For the App Links setup, 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>
To pass the deep link events to the Airbridge SDK, call the Airbridge.trackDeeplink
function at the top of the OS callback that is called when the app is opened through a deep link.
Add the following code 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 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(getIntent());
}
...
@Override
public void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(intent);
}
When an Airbridge Deep Link is executed, it is converted into a scheme deep link and passed to the OnDeeplinkReceived
callback. If a deep link that is not an Airbridge Deep Link is executed, the deep link is passed directly to the callback without any conversion.
Use the deep link passed to the callback 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.
Airbridge SDK 在初始化以后,如果满足以下所有条件,会尝试获取深度链接。如果在获取深度链接的过程中 App 被关闭,Airbridge SDK 会将视为没有保存的深度链接。
已设置 Opt-in 时调用 Airbridge.startTracking
函数;或未设置 Opt-in。
用户在 ATT 弹窗中做出选择,或 ATT 弹窗中设置的事件收集延迟时间已到期。
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.
Follow the instructions below for additional setup.
提示
此功能并非必需功能,请在设置前确认需求。
Note
The Airbridge Flutter SDK must be v4.1.2 or later.
The deep links passed through the setOnDeeplinkReceived
method of the Airbridge React Native SDK include not only Airbridge Deep Links but also deep links from other solutions.
import 'package:airbridge_flutter_sdk/airbridge_flutter_sdk.dart';
...
Airbridge.setOnDeeplinkReceived((url) {
// show proper content using url
});
By configuring isHandleAirbridgeDeeplinkOnly
to true
in the SDK settings, only Airbridge Deep Links will be passed to the setOnDeeplinkReceived
callback. In this way, you can handle the deep links from other solutions separately from the Airbridge Deep Links.
Was this page helpful?