βxβ
<head>
<link rel="alternate" hreflang="en" href="https://developers.airbridge.io/v1.1-en/docs/react-native-sdk" />
<link rel="alternate" hreflang="ko" href="https://developers.airbridge.io/docs/react-native-sdk" />
</head>
## SDK Installation
xxxxxxxxxx
<hr/>
### Package Installation
#### npm
Install `airbridge-react-native-sdk
` using npm.
xxxxxxxxxx
1npm install --save airbridge-react-native-sdk
#### React-native link or cocoapods
Execute the following command.
xxxxxxxxxx
1cd ios
pod install
ο»Ώ
### Project Setup
#### Import
Add the following code to the `index.js
` file of the project to import the Airbridge SDK.
xxxxxxxxxx
1import Airbridge from 'airbridge-react-native-sdk';
ο»Ώ
### Project Setup (Android)
#### MainApplication.java
Add the following code to the `onCreate
` function within the `android/app/src/main/java/.../MainApplication.java
` file.
xxxxxxxxxx
110import co.ab180.airbridge.reactnative.AirbridgeRN;
β
//...
β
public void onCreate() {
super.onCreate();
AirbridgeRN.init(this, "YOUR_APP_NAME", "YOUR_APP_TOKEN");
...
}
`
APP_NAME
` can be found at the **"Airbridge dashboard β Settings β Tokens β App Name"**. `APP_TOKEN
` can be found at the **"Airbridge dashboard β Settings β Tokens β App SDK Token"**.
ο»Ώ
### Project Setup (iOS)
#### `AppDelegate.m
`
Add the following code to the import section of the `ios/[Project Name]/AppDelegate.m
` file.
xxxxxxxxxx
1
ο»Ώ
Use a bridge header if you are using Swift.
Add the following code to the `application:idFinishLaunchingWithOptions:
` function within the `ios/[Project Name]/AppDelegate.m
` file.
xxxxxxxxxx
1- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[AirbridgeRN getInstance:@"YOUR_APP_TOKEN" appName:@"YOUR_APP_NAME" withLaunchOptions:launchOptions];
...
}
`
APP_NAME
` can be found at the **"Airbridge dashboard β Settings β Tokens β App Name"**. `APP_TOKEN
` can be found at the **"Airbridge dashboard β Settings β Tokens β App SDK Token"**.
ο»Ώ
### React Native Settings
#### `airbridge.json
`
Create an `
airbridge.json
` file in the project folder.Configure settings in JSON format.
When using React Native 0.59.X or lower with iOS, the below setup is needed for iOS.
Go to "Xcode β Project file β Build Phases β Copy Bundle Resources".
Click "+" and add airbridge.json file.
#### Example
xxxxxxxxxx
112{
"sessionTimeoutSeconds": 300,
"autoStartTrackingEnabled": true,
"userInfoHashEnabled": true,
"trackAirbridgeLinkOnly": false,
"facebookDeferredAppLinkEnabled": false,
"locationCollectionEnabled": false,
"trackingAuthorizeTimeoutSeconds": 30000,
"sdkSignatureSecretID": "YOUR_SDK_SIGNATURE_SECRET_ID",
"sdkSignatureSecret": "YOUR_SDK_SIGNATURE_SECRET",
"logLevel": "warning"
}
ο»Ώ
`
trackingAuthorizeTimeoutSeconds
` in the above code is the default value. Please adjust accordingly depending on your user experience and ATT prompt settings. Please refer to [Tracking Authorize Timeout Settings](πο»Ώ) for more details.
Name | Type | Default | Description |
sessionTimeoutSeconds | Number | 300 | An app open event will not be sent when the app is reopened within the designated period. |
autoStartTrackingEnabled | Boolean | true | When set to false, no events will be sent until `Airbridge.state.startTracking() ` is called. |
userInfoHashEnabled | Boolean | true | When set to false, user email and user phone information are sent without being hashed. |
trackAirbridgeLinkOnly | Boolean | false | When set to true, deep link events are sent only when app is opened with an Airbridge deep link. |
facebookDeferredAppLinkEnabled | Boolean | false | When set to true and the Facebook SDK is installed, Facebook Deferred App Link data is collected. |
locationCollectionEnabled | Boolean | false | When set to true, location information is collected. (Android Only) Two permissions must be allowed in AndroidManifest.xml android.permission.ACCESS_FINE_LOCATION android.permission.ACCESS_COARSE_LOCATION |
trackingAuthorizeTimeoutSeconds | Number | 0 | When timeout is set, Install event is delayed until `Request tracking authorization alert ` is clicked. (iOS only) |
sdkSignatureSecretID | String | null | Protects against SDK spoofing. Both sdkSignatureSecretID and sdkSignatureSecret values must be applied. |
sdkSignatureSecret | String | null | Protects against SDK spoofing. Both sdkSignatureSecretID and sdkSignatureSecret values must be applied. |
logLevel | String | Warning | Adjusts the log record level for Airbridge. logLevel: "debug" | "info" | "warning" | "error" | "fault" |
ο»Ώ
### Testing the SDK
Check if install events are sent when the application is installed and opened.
#### Check in the Airbridge Dashboard
Events from the Airbridge SDK are shown at the "Airbridge Dashboard β Raw Data β App Real-time Logs".
Go to the "Airbridge Dashboard β Raw Data β App Real-time Logs".
Search for the device's ADID (IDFA, IDFV, GAID).
Logs may be delayed for up to 5 minutes.
<br><br>
## Deep Link Setup
xxxxxxxxxx
<hr/>
### Dashboard Setup
Please refer to the following guides for setting up deep links in the Airbridge dashboard.
ο»Ώ[Deep link setup for Android](πο»Ώ)ο»Ώ
ο»Ώ[Deep link setup for iOS](πο»Ώ)ο»Ώ
ο»Ώ
### Project Setup
#### setDeeplinkListener
Register a function that will be called whenever a deep link or a deferred deep link opens the application.
xxxxxxxxxx
1Airbridge.deeplink.setDeeplinkListener((deeplink) => {
// code that will run when a deep link or deferred deep link occurs
// deeplink = YOUR_SCHEME://...
β
console.log(deeplink);
});
All deep links that open apps are sent to `
DeeplinkCallback
` Of those deep links, "Airbridge deep links" will be sent using the URI Scheme (`YOUR_SCHEME://...
`) that was set in the Airbridge dashboard.
ο»Ώ
### Project Setup (Android)
#### AndroidManifest.xml
In the `MainActivity
` section of the `android/app/src/main/AndroidManifest.xml
` file, add `android:LaunchMode
` and `intent-filter
` parameters as below.
xxxxxxxxxx
131<activity/>
<activity android:name=".MainActivity"
android:launchMode="singleTask"
...>
<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.deeplink.page" />
<data android:scheme="https" android:host="YOUR_APP_NAME.deeplink.page" />
</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>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
β
<category android:name="android.intent.category.DEFAULT" />
Enter your app name at `
APP_NAME
`. Enter your scheme value set in the Airbridge dashboard at `YOUR_SCHEME
`. (e.g. `abc://
`)
#### MainActivity.java
Insert the following code in the `android/app/src/main/java/.../MainActivity.java
` file.
xxxxxxxxxx
112protected void onResume() {
super.onResume();
β
AirbridgeRN.processDeeplinkData(getIntent());
}
β
public void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(intent);
}
ο»Ώ
### Project Setup (iOS)
#### Scheme
Go to "Xcode β Project file β Info β URL Types".
From the Airbridge dashboard, copy "iOS URI Scheme" to Xcode's "URL Schemes". (Do not include `
://
`)

#### Universal Link
Go to "Xcode β Project file β Signing & Capabilities".
Click "+ Capability" and add "Associated Domains".
Add `
applinks:YOUR_APP_NAME.airbridge.io
` to "Associated Domains".Add `
applinks:YOUR_APP_NAME.deeplink.page
` to "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.
#### Send Deep Link Information to SDK
Open `
ios/[Project name]/AppDelegate
`.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.
xxxxxxxxxx
110- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
options:(NSDictionary<UIApplicationOpenURLOptionsKey, id>*)options
{
NSLog(@"openURL : %@", url);
β
[AirbridgeRN.deeplink handleURLSchemeDeeplink:url];
β
return YES;
}
When targeting iOS 8.x or earlier, also call the `
handleURLSchemeDeeplink
` method at the beginning of the following function.
xxxxxxxxxx
111- (BOOL)application:(UIApplication*)application
openURL:(NSURL*)url
sourceApplication:(NSString*)sourceApplication
annotation:(id)annotation
{
NSLog(@"openURL : %@", url);
β
[AirbridgeRN.deeplink handleURLSchemeDeeplink:url];
β
return YES;
}
Send deep link information to the SDK when the application is opened through an universal link by calling the `
handleUniversalLink
` method at the beginning of the following function.
xxxxxxxxxx
110- (BOOL)application:(UIApplication*)application
continueUserActivity:(NSUserActivity*)userActivity
restorationHandler:(void (^)(NSArray* _Nullable))restorationHandler
{
NSLog(@"continueUserActivity : %@", userActivity.webpageURL);
β
[AirbridgeRN.deeplink handleUniversalLink:userActivity.webpageURL];
β
return YES;
}
ο»Ώ
### Custom Domain Setup (Optional)
Please refer to the below guides to setup your custom domain with Airbridge.
iOS: [Guide](πο»Ώ) Android: [Guide](πο»Ώ)ο»Ώ
ο»Ώ
### Test Deep Link
Click on your URI scheme to test if your deep link has been properly set up in the Airbridge SDK.
`
YOUR_APP_URI_SCHEME://
`
The results will show on the "Airbridge dashboard β Row Data β App Real-time Log" tab if everything is working.
<br><br>
## User Setup
xxxxxxxxxx
<hr/>
### User Identifier Setup
Once a user identifier information is sent to the SDK, all events thereafter will contain the corresponding user identifier information.
Name | Description | Limitations |
ID | User ID | - |
User Email | Hashed by default (SHA256, can be disabled) | |
phone | User phone number | Hashed by default (SHA256, can be disabled) |
attributes | User attributes | - Maximum 100 attributes
- "key" type is string, maximum 128 characters
- "key" must satisfy `^[a-z_][a-z0-9_]*$ ` regex
- "value" type is primitive or string
- Maximum 1024 characters when "value" is string |
alias | Another User ID | - Maximum 10 aliases
- `"key" ` type is String, maximum 128 characters
- `"key" ` must satisfy `^[a-z_][a-z0-9_]*$ ` regex
- \`"value" type is String, maximum 1024 characters |
#### Example
xxxxxxxxxx
113Airbridge.state.setUser({
ID: 'personID1',
email: 'persondoe1@airbridge.io',
});
β
Airbridge.state.setUser({
email: 'persondoe2@airbridge.io',
phone: '1(123)123-1234',
});
β
Airbridge.state.updateUser({
ID: 'personID3',
});
The above code operates in the following order.
User = { ID: 'personID1', email: '[persondoe1@airbridge.io](πο»Ώ)' }
User = { ID: 'personID1', email: '[persondoe1@airbridge.io](πο»Ώ)', phone: '1(123)123-1234' }
User = { ID: 'personID3', email: '[persondoe2@airbridge.io](πο»Ώ)', phone: '1(123)123-1234)' }
ο»Ώ
### User Attribute Setup
Additional user attributes can be set for various purposes such as MTA (Multi-Touch Attribution) analysis, internal data analysis and 3rd party solution integrations.
xxxxxxxxxx
1Airbridge.state.updateUser({
attributes: {
age_group: "30",
gender: "Female"
}
});
ο»Ώ
### Testing
Make sure that your user information settings are being properly sent through the SDK.
Configure user identifier information.
Send an event using the SDK.
Click the event at "Airbridge dashboard β Raw Data β App Real-time Logs"
Check if the user information is correctly sent under the `
user
` block.
<br><br>
## Device Setup
xxxxxxxxxx
<hr/>
### Setup Device Alias
Setup a device alias through the Airbridge SDK. The alias will be sustained even after the app closes, unless otherwise deleted.
xxxxxxxxxx
1Airbridge.setDeviceAlias("ADD_YOUR_KEY", "AND_YOUR_VALUE");
Airbridge.removeDeviceAlias("DELETE_THIS_KEY");
Airbridge.clearDeviceAlias();
ο»Ώ | ο»Ώ |
`setDeviceAlias(key: string, value: string) ` | Add the key value pair to the device identifier. |
`removeDeviceAlias(key: string) ` | Delete the corresponding device alias. |
`clearDeviceAlias() ` | Delete all device aliases. |
<br><br>
## Event Setup
xxxxxxxxxx
<hr/>
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.
`
action
`, `label
`, `value
`, `customAttributes
` and `semanticAttributes
` can be used for event options.
xxxxxxxxxx
1/**
* Send event to server.
* @param {string} category event name
* @param {EventOption} [option={}] event options
*/
trackEvent(category: string, option?: EventOption): void;
ο»Ώ
### User Events
Send user events with the SDK.
`
action
`, `label
`, `value
`, `customAttributes
` and `semanticAttributes
` can be used for user events.
#### Sign Up
User identifiers are set with `
setUser
` and then sent with `AirbridgeCategory.SIGN_UP
` for user sign ups.
xxxxxxxxxx
1Airbridge.state.setUser({
ID: 'personID1',
email: 'persondoe@airbridge.io',
phone: '1(123)123-1234',
});
Airbridge.trackEvent(AirbridgeCategory.SIGN_UP);
#### Sign In
User identifiers are set with `
setUser
` and then sent with `AirbridgeCategory.SIGN_IN
` for user logins.
xxxxxxxxxx
1Airbridge.state.setUser({
ID: 'personID1',
email: 'persondoe@airbridge.io',
phone: '1(123)123-1234',
});
Airbridge.trackEvent(AirbridgeCategory.SIGN_IN);
#### Sign Out
Send the sign out event with `
AirbridgeCategory.SIGN_OUT
`, and then reset the user identifiers with `Airbridge.state.setUser({})
`.
xxxxxxxxxx
1Airbridge.trackEvent(AirbridgeCategory.SIGN_OUT);
Airbridge.state.setUser({});
ο»Ώ
### E-commerce Events
#### Send e-commerce events with the SDK.
`
action
`, `label
`, `value
`, `customAttributes
` and `semanticAttributes
` can be used for e-commerce events. It is possible to include product information using `semanticAttributes
`. Custom key values can be used along with the pre-defined values.
#### View Home Screen
xxxxxxxxxx
1Airbridge.trackEvent(AirbridgeCategory.HOME_VIEW);
#### View Product Detail
xxxxxxxxxx
114Airbridge.trackEvent(AirbridgeCategory.PRODUCT_DETAILS_VIEW, {
semanticAttributes: {
[AirbridgeAttributes.PRODUCTS]: [
{
[AirbridgeProduct.PRODUCT_ID]: 'coke_zero',
[AirbridgeProduct.NAME]: 'Coke Zero',
[AirbridgeProduct.PRICE]: 1.99,
[AirbridgeProduct.CURRENCY]: 'USD',
[AirbridgeProduct.POSITION]: 1,
[AirbridgeProduct.QUANTITY]: 1,
},
]
}
});
#### View Product List
xxxxxxxxxx
123Airbridge.trackEvent(AirbridgeCategory.PRODUCT_LIST_VIEW, {
semanticAttributes: {
[AirbridgeAttributes.PRODUCT_LIST_ID]: 'ID-1234567890'
[AirbridgeAttributes.PRODUCTS]: [
{
[AirbridgeProduct.PRODUCT_ID]: 'coke_zero',
[AirbridgeProduct.NAME]: 'Coke Zero',
[AirbridgeProduct.PRICE]: 1.99,
[AirbridgeProduct.CURRENCY]: 'USD',
[AirbridgeProduct.POSITION]: 1,
[AirbridgeProduct.QUANTITY]: 1,
},
{
[AirbridgeProduct.PRODUCT_ID]: 'burger_cheese_double',
[AirbridgeProduct.NAME]: 'Double Cheeseburger',
[AirbridgeProduct.PRICE]: 3.99,
[AirbridgeProduct.CURRENCY]: 'USD',
[AirbridgeProduct.POSITION]: 2,
[AirbridgeProduct.QUANTITY]: 1,
},
]
}
});
#### View Search Result
xxxxxxxxxx
123Airbridge.trackEvent(AirbridgeCategory.SEARCH_RESULT_VIEW, {
semanticAttributes: {
[AirbridgeAttributes.QUERY]: 'product'
[AirbridgeAttributes.PRODUCTS]: [
{
[AirbridgeProduct.PRODUCT_ID]: 'coke_zero',
[AirbridgeProduct.NAME]: 'Coke Zero',
[AirbridgeProduct.PRICE]: 1.99,
[AirbridgeProduct.CURRENCY]: 'USD',
[AirbridgeProduct.POSITION]: 1,
[AirbridgeProduct.QUANTITY]: 1,
},
{
[AirbridgeProduct.PRODUCT_ID]: 'burger_cheese_double',
[AirbridgeProduct.NAME]: 'Double Cheeseburger',
[AirbridgeProduct.PRICE]: 3.99,
[AirbridgeProduct.CURRENCY]: 'USD',
[AirbridgeProduct.POSITION]: 2,
[AirbridgeProduct.QUANTITY]: 1,
},
]
}
});
#### Add to cart
xxxxxxxxxx
125Airbridge.trackEvent(AirbridgeCategory.ADD_TO_CART, {
semanticAttributes: {
[AirbridgeAttributes.CART_ID]: 'ID-1234567890',
[AirbridgeAttributes.CURRENCY]: 'USD',
[AirbridgeAttributes.TOTAL_VALUE]: 5.98,
[AirbridgeAttributes.PRODUCTS]: [
{
[AirbridgeProduct.PRODUCT_ID]: 'coke_zero',
[AirbridgeProduct.NAME]: 'Coke Zero',
[AirbridgeProduct.PRICE]: 1.99,
[AirbridgeProduct.CURRENCY]: 'USD',
[AirbridgeProduct.POSITION]: 1,
[AirbridgeProduct.QUANTITY]: 1,
},
{
[AirbridgeProduct.PRODUCT_ID]: 'burger_cheese_double',
[AirbridgeProduct.NAME]: 'Double Cheeseburger',
[AirbridgeProduct.PRICE]: 3.99,
[AirbridgeProduct.CURRENCY]: 'USD',
[AirbridgeProduct.POSITION]: 2,
[AirbridgeProduct.QUANTITY]: 1,
},
]
}
});
#### Purchase
xxxxxxxxxx
126});
Airbridge.trackEvent(AirbridgeCategory.ORDER_COMPLETED, {
semanticAttributes: {
[AirbridgeAttributes.TRANSACTION_ID]: 'transactionID-purchase',
[AirbridgeAttributes.CURRENCY]: 'USD',
[AirbridgeAttributes.TOTAL_VALUE]: 5.98,
[AirbridgeAttributes.IN_APP_PURCHASED]: true,
[AirbridgeAttributes.PRODUCTS]: [
{
[AirbridgeProduct.PRODUCT_ID]: 'coke_zero',
[AirbridgeProduct.NAME]: 'Coke Zero',
[AirbridgeProduct.PRICE]: 1.99,
[AirbridgeProduct.CURRENCY]: 'USD',
[AirbridgeProduct.POSITION]: 1,
[AirbridgeProduct.QUANTITY]: 1,
},
{
[AirbridgeProduct.PRODUCT_ID]: 'burger_cheese_double',
[AirbridgeProduct.NAME]: 'Double Cheeseburger',
[AirbridgeProduct.PRICE]: 3.99,
[AirbridgeProduct.CURRENCY]: 'USD',
[AirbridgeProduct.POSITION]: 2,
[AirbridgeProduct.QUANTITY]: 1,
},
]
}
ο»Ώ
### Verify Event Transmission
Make sure that the events are being properly sent through the SDK.
Send an event with the SDK.
Check if the event shows up at "Airbridge dashboard β Raw Data β Web Real-time Logs".
<br><br>
## Advanced Setup
xxxxxxxxxx
<hr/>
### SDK Signature Setup
Protection against SDK spoofing is possible once you set your SDK Signature. This feature is available for the Airbridge React Native SDK v2.3.0 and above.
Add the following lines in the airbridge.json file.
xxxxxxxxxx
1{
"sdkSignatureSecretID": "YOUR_SDK_SIGNATURE_SECRET_ID",
"sdkSignatureSecret": "YOUR_SDK_SIGNATURE_SECRET"
}
ο»Ώ
Please ask your CSM for the "SDK Signature Secret ID" and "SDK Signature Secret" values.
ο»Ώ
### Session Timeout
Configure the `sessionTimeoutSeconds
` parameter of [airbridge.json](πο»Ώ). App open events will not be sent again if the user re-opens the app within the `sessionTimeoutSeconds
` value.
Session timeout is in milliseconds and must range between 0 and 604800000 (7 days). Default value is 1000 _ 60 _ 5 (5 minutes).
ο»Ώ
### Hash User Indentifier
Email addresses and phone numbers are hashed by default. (SHA256)
You can stop hashing email and phone information by configuring the `userInfoHashEnabled
` parameter of [airbridge.json](πο»Ώ).
ο»Ώ
You must take appropriate measures internally when personal information is not hashed.
ο»Ώ
### Track Facebook Deferred App Links
The Airbridge SDK can track Facebook Deferred App Links by utilizing the `facebookDeferredAppLinkEnabled
` parameter of [airbridge.json](πο»Ώ).
Install the Facebook SDK: <https://developers.facebook.com/docs/ios/getting-started>.
Set `
facebookDeferredAppLinkEnabled
` of [airbridge.json](πο»Ώ) to `true
`.
ο»Ώ
The Facebook SDK must be configured beforehand. [Reference](πο»Ώ)ο»Ώ
ο»Ώ
### Track Airbridge Deep Links Only
The SDK will send all deep link events when the app is opened using a deep link.
If you're having difficulty tracking the re-engagement performance due to various deep link actions within the app, set `trackAirbridgeLinkOnly
` of [Airbridge API Reference](πο»Ώ) to true. The SDK will only send deep link events that use Airbridge deep links.
Airbridge deep links are defined as...
Deep links registered on the Airbridge dashboard
`
airbridge.io
` deep links`
deeplink.page
` deep linksContains the `
airbridge_referrer
` query information
ο»Ώ
### Privacy Protection (Opt-Out)
When `autoStartTrackingEnabled
` of [airbridge.json](πο»Ώ) is set to false, the Airbridge SDK will not send events to the Airbridge server until the `Airbridge.state.startTracking
` method is called.
This feature is useful for compliances such as [GDPR](πο»Ώ) and [CCPA](πο»Ώ).
ο»Ώ
### Tracking Authorize Timeout (iOS only)
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.
When `trackingAuthorizeTimeoutSeconds
` of [airbridge.json](πο»Ώ) is set to true, the install event will be sent after the `timeout
` period or delayed until an ATT option is selected.
ο»Ώ
### Location Tracking (Android Only)
Track a user's location through the `locationCollectionEnabled
` parameter of the [airbridge.json](πο»Ώ) file.
ο»Ώ
Location information must be collected for legal purposes only.
ο»Ώ
This function is available for Android only, and the following permissions must be allowed in `
AndroidManifest.xml
`.`
uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /
` `uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /
`
### Tracking Link Execution
Use the code below to execute and track deep links in the app.
xxxxxxxxxx
1Airbridge.placement.click('https://abr.ge/~~~', 'ablog://main', 'https://airbridge.io');
Airbridge.placement.impression('https://abr.ge/~~~');
#### `click
`
The `click
` function adds a "click" statistic to the corresponding tracking link, then moves to the pre-set app, web or fallback.
Call the `click
` function when the tracking link is clicked on.
The deep link and fallback are "backup links" used when there is no Internet connection. Deep link parameters are only available in Custom URL Scheme format. (All these parameters are optional)
#### `impression
`
The `impression
` function adds an "impression" statistic to the corresponding tracking link.
Call the `impression
` function when the tracking is displayed.
If you are using a "custom domain" for your tracking link, it can not be used with a "custom short ID". example: `
http://deeplink.customdomain.com/custom
` -> Not possible example: `http://deeplink.customdomain.co/autogenerated
` -> Possible example: `https://abr.ge/autogenerated
` -> Possible
ο»Ώ
### Get deviceUUID
xxxxxxxxxx
1await Airbridge.state.deviceUUID()
ο»Ώ
### Uninstall tracking
ο»Ώ
This feature is available only for React Native SDK v2.1.0+.
Airbridge Android SDK v2.6.0+
Airbridge iOS SDK v1.28.2+
Please refer to [this guide](πο»Ώ) for details.
#### Send Push Token
xxxxxxxxxx
1Airbridge.registerPushToken(token);
Forward the push token to Airbridge using the `registerPushToken
` method.
Make sure the notification is not shown on the device if the remote message value is `airbridge-uninstall-tracking
`.
<br><br>
## Hybrid App Setup
xxxxxxxxxx
<hr/>
Additional events such as app installs, app open and deep link opens can't be tracked with just the web SDK. The following simple setup allows in-app events to be called for a hybrid app.
xxxxxxxxxx
1let webInterface = Airbridge.createWebInterface(
'YOUR_WEB_TOKEN',
(command) => {
return `...`;
}
)
`Airbridge.CreateWebInterface
` allows you to control the web interface.
Please refer to the [React Native Hybird App Integration Guide](πο»Ώ) for more information.
<br><br>
## Troubleshooting
xxxxxxxxxx
<hr/>
### Update 1.X.X β 2.X.X
The event API has been replaced to the below.
xxxxxxxxxx
1/**
* Send event to server.
* @param {string} category event name
* @param {EventOption} [option={}] event options
*/
trackEvent(category: string, option?: EventOption): void;
Refer to the [React native 2.X.X migration guide](πο»Ώ) for details.
ο»Ώ
### Bitcode Compile Error
An error like below may occur when creating iOS builds with React Native SDK v1.5.0+.
xxxxxxxxxx
1ld: XCFrameworkIntermediates/AirBridge/AirBridge.framework/AirBridge(AirBridge-arm64-master.o)' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE)
Since React Native SDK v1.5.0+ uses Airbridge iOS SDK v1.28.0+, Bitcode is no longer supported. Please refer to the [Bitcode compile error guide](πο»Ώ) for more details.
ο»Ώ
### Update 1.1.X β 1.2.X
#### npm
Change version of Airbridge React Native SDK in `package.json
`.
xxxxxxxxxx
1"airbridge-react-native-sdk": "1.2.1",
Execute the following command.
xxxxxxxxxx
1npm install
cd ios
pod install
#### Android
Modify `
android/app/src/main/java/.../MainActivity
`
xxxxxxxxxx
1- AirbridgeRN.getDeeplink().fetch(getIntent())
+ AirbridgeRN.processDeeplinkData(getIntent())
#### iOS
Modify `
ios/[Project Name]/AppDelegate
`
xxxxxxxxxx
1- AirbridgeRN.deeplink()?.handleURLSchemeDeeplink(url, withSourceBundle: sourceApplication)
+ AirbridgeRN.deeplink()?.handleURLSchemeDeeplink(url)
#### Settings
Add an `
airbridge.json
` file to the project folder.Add the parameters shown in the example below in JSON format.
xxxxxxxxxx
1{
"sessionTimeoutSeconds": 300,
"autoStartTrackingEnabled": true,
"userInfoHashEnabled": true,
"trackAirbridgeLinkOnly": false,
"facebookDeferredAppLinkEnabled": false,
"locationCollectionEnabled": false
"trackingAuthorizeTimeoutSeconds": 0
}
##### Description
Name | Type | Default | Description |
sessionTimeoutSeconds | number | 300 | An app open event will not be sent when the app is reopened within the designated period. |
autoStartTrackingEnabled | boolean | true | When set to false, no events will be sent until `airbridge.state.startTracking() ` is called. |
userInfoHashEnabled | boolean | true | When set to false, user email and user phone information are sent without being hashed. |
trackAirbridgeLinkOnly | boolean | false | When set to true, deep link events are sent only when app is opened with an Airbridge deep link. |
facebookDeferredAppLinkEnabled | boolean | false | When set to true and the Facebook SDK is installed, Facebook Deferred App Link data is collected. |
locationCollectionEnabled | boolean | false | When set to true, location information is collected. (Android Only)
Two permissions must be allowed in `AndroidManifest.xml `
android.permission.ACCESS_FINE_LOCATION
android.permission.ACCESS_COARSE_LOCATION |
trackingAuthorizeTimeoutSeconds | number | 0 | When set timeout, Install event is delayed until Request tracking authorization alert is clicked. (iOS only) |
ο»Ώ
### Update 1.0.X β 1.1.X
#### Installation
Uninstall the old version of the Airbridge SDK.
xxxxxxxxxx
1npm uninstall react-native-airbridge-bridge
Install the new version of the Airbridge SDK.
xxxxxxxxxx
1npm install --save airbridge-react-native-sdk
After Installation, execute the following command.
xxxxxxxxxx
1cd ios
pod install
#### `setDeeplinkListener
`
Remove the `getInitialDeeplink
` function and use the `setDeeplinkListener
` function only.
xxxxxxxxxx
1- Airbridge.deeplink.getInitialDeeplink().then((deeplink) => {
-
- });
.
. Airbridge.deeplink.setDeeplinkListner((deeplink) => {
.
. });
#### Android
##### `AndroidManifest.xml
`
In the `MainActivity
` section of the `android/app/src/main/AndroidManifest.xml
` file, add `intent-filter
` parameters as below.
xxxxxxxxxx
126. </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="APP_NAME.deeplink.page" />
+ <data android:scheme="https" android:host="APP_NAME.deeplink.page" />
+ </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="APP_NAME.airbridge.io" />
. <data android:scheme="https" android:host="APP_NAME.airbridge.io" />
. </intent-filter>
. <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="EXAMPLE_SCHEME" />
##### `MainActivity.java
`
Modify `android/app/src/main/java/.../MainActivity.java
` as below.
xxxxxxxxxx
116. import co.ab180.airbridge.reactnative.AirbridgeRN;
.
. public class MainActivity extends ReactActivity {
+ @Override
+ protected void onResume() {
+ super.onResume();
+
+ AirbridgeRN.getDeeplink().fetch(getIntent());
+ }
+
. @Override
. public void onNewIntent(Intent intent) {
. super.onNewIntent(intent);
. setIntent(intent);
. }
. }
#### iOS
##### Universal Link
Go to "Xcode β Project file β Signing & Capabilities".
Click "+ Capability" and add "Associated Domains".
Add `
applinks:YOUR_APP_NAME.deeplink.page
` to "Associated Domains".
`
YOUR_APP_NAME
` can be found at the "Airbridge dashboard β Settings β Tokens β App Name".
##### AppDelegate.m\`
Modify `ios/.../AppDelegate.m
` as below.
xxxxxxxxxx
124. - (BOOL)application:(UIApplication *)application
. openURL:(NSURL *)url
. options:(NSDictionary<UIApplicationOpenURLOptionsKey, id>*)options
. {
- [AirbridgeRN.instance handleURLSchemeDeeplink:url
- withSourceBundle:options[UIApplicationOpenURLOptionsSourceApplicationKey]];
+ [AirbridgeRN.deeplink handleURLSchemeDeeplink:url
+ withSourceBundle:options[UIApplicationOpenURLOptionsSourceApplicationKey]];
.
. return YES;
. }
.
. - (BOOL)application:(UIApplication*)application
. openURL:(NSURL*)url
. sourceApplication:(NSString*)sourceApplication
. annotation:(id)annotation
. {
- [AirbridgeRN.instance handleURLSchemeDeeplink:url
- withSourceBundle:sourceApplication];
+ [AirbridgeRN.deeplink handleURLSchemeDeeplink:url
+ withSourceBundle:sourceApplication];
.
. return YES;
. }
When targeting iOS 8.x or earlier, also make the following changes.
xxxxxxxxxx
1. - (BOOL)application:(UIApplication*)application
. continueUserActivity:(NSUserActivity*)userActivity
. restorationHandler:(void (^)(NSArray* _Nullable))restorationHandler
. {
- [AirbridgeRN.instance handleUniversalDeeplink:userActivity.webpageURL];
+ [AirbridgeRN.deeplink handleUniversalLink:userActivity.webpageURL];
.
. return YES;
. }
ο»Ώ
### Update 0.2.X β 1.X.X
#### Reinstalling the Airbridge SDK
Unlink the old version of the SDK.
xxxxxxxxxx
1react-native unlink react-native-airbridge-bridge
Follow the steps below when an error occurs with `react-native unlink react-native-airbridge-bridge
`
(Android) Modify `
android/app/src/main/java/.../MainApplication.java
` as below.
xxxxxxxxxx
1- import com.reactlibrary.AirbridgeBridgePackage;
xxxxxxxxxx
1. @Override
. protected List<ReactPackage> getPackages() {
. return Arrays.<ReactPackage>asList(
+ new MainReactPackage()
- new MainReactPackage(),
- new AirbridgeBridgePackage()
. );
. }
(iOS) Open `
ios/xxx.xcodeproj
`.(iOS) Remove `
AirbridgeBridge.xcodeproj
` in `Libraries
`
Uninstall the old version of the SDK.
xxxxxxxxxx
1npm uninstall react-native-airbridge-bridge
Install the new version of the SDK.
xxxxxxxxxx
1npm install --save airbridge-react-native-sdk
Link the new version of the SDK.
xxxxxxxxxx
1react-native link airbridge-react-native-sdk
#### `index.js
`
Modify `index.js
` as below.
xxxxxxxxxx
1- const Airbridge = require('react-native-airbridge-bridge');
+ import Airbridge from 'airbridge-react-native-sdk';
#### `build.gradle
` (Android)
Modify `android/app/build.gradle
` as below.
xxxxxxxxxx
1. dependencies {
. ...
- implementation 'io.airbridge:sdk-android:1.5.+'
- implementation 'com.android.installreferrer:installreferrer:1.0'
. ...
. }
#### `AndroidManifest.xml
` (Android)
Modify `android/app/src/main/AndroidManifest.xml
` as below.
##### `permission
` (Android)
xxxxxxxxxx
1- <uses-permission android:name="android.permission.INTERNET" />
- <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
##### `MainActivity
`
xxxxxxxxxx
1. <activity android:name=".MainActivity"
...
+ android:launchMode="singleTask">
#### `MainApplication.java
` (Android)
Modify `android/app/src/main/java/.../MainApplication.java
` as below.
xxxxxxxxxx
1- import io.airbridge.*;
xxxxxxxxxx
1. @Override
. public void onCreate() {
. super.onCreate();
- AirBridge.init(this, "[APP_NAME]", "[APP_TOKEN]");
+ AirbridgeRN.init(this, "[APP_NAME]", "[APP_TOKEN]");
. ...
. }
#### `MainActivity.java
` (Android)
Modify `android/app/src/main/java/.../MainActivity.java
` as below.
xxxxxxxxxx
1+ import co.ab180.airbridge.reactnative.AirbridgeRN;
β
+ public class MainActivity extends ReactActivity {
+ @Override
+ public void onNewIntent(Intent intent) {
+ super.onNewIntent(intent);
+ setIntent(intent);
+ }
#### `Podfile
` (iOS)
Modify `ios/Podfile
` as below.
xxxxxxxxxx
1target '[νλ‘μ νΈ μ΄λ¦]' do
- pod 'AirBridge', '1.6.2'
end
Run the command below in terminal.
xxxxxxxxxx
1pod install
#### `AppDelegate.m
` (iOS)
Modify `ios/.../AppDelegate.m
` as below.
xxxxxxxxxx
1- #import <AirBridge/AirBridge.h>
+ #import <AirbridgeRN/AirbridgeRN.h>
xxxxxxxxxx
1. - (BOOL)application:(UIApplication *)application
. didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
. {
- [AirBridge getInstance:@"APP_TOKEN" appName:@"APP_NAME" withLaunchOptions:launchOptions];
+ [AirbridgeRN getInstance:@"APP_TOKEN" appName:@"APP_NAME" withLaunchOptions:launchOptions];
. ...
. }
xxxxxxxxxx
1. - (BOOL)application:(UIApplication *)application
. openURL:(NSURL *)url
. options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
. {
- [[AirBridge instance] handleURL:url];
+ [AirbridgeRN.instance handleURLSchemeDeeplink:url withSourceBundle:options[UIApplicationOpenURLOptionsSourceApplicationKey]];.
.
. return YES;
. }
xxxxxxxxxx
110. - (BOOL)application:(UIApplication *)application
. openURL:(NSURL *)url
. sourceApplication:(NSString *)sourceApplication
. annotation:(id)annotation
. {
- [[AirBridge instance] handleURL:url];
+ [AirbridgeRN.instance handleURLSchemeDeeplink:url withSourceBundle:options[UIApplicationOpenURLOptionsSourceApplicationKey]];
.
. return YES;
. }
When targeting iOS 8.x or earlier, also make the following changes.
xxxxxxxxxx
1. - (BOOL)application:(UIApplication *)application
. continueUserActivity:(NSUserActivity *)userActivity
. restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler
. {
- [[AirBridge instance] handleURL:url];
+ [AirbridgeRN.instance handleUniversalDeeplink:userActivity.webpageURL];
.
. return YES;
. }
ο»Ώ