SDK Installation
Package Installation
npm
Installairbridge-react-native-sdk using npm.
React-native link or CocoaPods
Execute the following command.Project Setup
Import
Add the following code to theindex.js file of the project to import the Airbridge SDK.
Project Setup (Android)
MainApplication.java
Add the following code to theonCreate function within the android/app/src/main/java/.../MainApplication.java file.
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.
AttentionUse a bridge header if you are using Swift.
application:idFinishLaunchingWithOptions: function within the ios/[Project Name]/AppDelegate.m file.
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.jsonfile in the project folder. - Configure settings in JSON format.
- Go to “Xcode → Project file → Build Phases → Copy Bundle Resources”.
- Click ”+” and add
airbridge.jsonfile.
Example
Attention
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.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).
Deep Link Setup
Dashboard Setup
Please refer to the following guides for setting up deep links in the Airbridge dashboard.Project Setup
setDeeplinkListener
Register a function that will be called whenever a deep link or a deferred deep link opens the application.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 theMainActivity section of the android/app/src/main/AndroidManifest.xml file, add android:LaunchMode and intent-filter parameters as below.
APP_NAME.
Enter your scheme value set in the Airbridge dashboard at YOUR_SCHEME.
MainActivity.java
Insert the following code in theandroid/app/src/main/java/.../MainActivity.java file.
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.ioto “Associated Domains”. - Add
applinks:YOUR_APP_NAME.deeplink.pageto “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
handleURLSchemeDeeplinkmethod at the beginning of the following function.
- When targeting iOS 8.x or earlier, also call the
handleURLSchemeDeeplinkmethod at the beginning of the following function.
- Send deep link information to the SDK when the application is opened through an universal link by calling the
handleUserActivitymethod at the beginning of the following function.
Custom Domain Setup (Optional)
Please refer to the below guides to setup your custom domain with Airbridge. iOS: Guide Android: GuideTest 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://
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.Example
- 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.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
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.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.
action, label, value, customAttributes and semanticAttributes can be used for event options.
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 withsetUser and then sent with AirbridgeCategory.SIGN_UP for user sign ups.
Sign In
User identifiers are set withsetUser and then sent with AirbridgeCategory.SIGN_IN for user logins.
Sign Out
Send the sign out event withAirbridgeCategory.SIGN_OUT, and then reset the user identifiers with 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
View Product Detail
View Product List
View Search Result
Add to Cart
Purchase
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”.
Advanced Setup
Install Restricted SDK
Restricted SDK does not collect device IDs, including Ad ID. The restricted SDK will be available starting fromv2.5.3.
Install using NPM
Install react-native link or CocoaPods
Setup Project
Obtain the object in the project’s index.js file with the following code.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.jsonfile.
The SDK Signature Credentials are required for the SDK Signature setup. Refer to this article to learn how to create them.
Session Timeout
Configure thesessionTimeoutSeconds 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 theuserInfoHashEnabled 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 thefacebookDeferredAppLinkEnabled parameter of airbridge.json.
- Install the Facebook SDK:
- Set
facebookDeferredAppLinkEnabledofairbridge.jsontotrue.
AttentionThe 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, settrackAirbridgeLinkOnly of airbridge.json 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.iodeep linksdeeplink.pagedeep links- Contains the
airbridge_referrerquery information
Privacy Protection (Opt-Out)
WhenautoStartTrackingEnabled 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. WhentrackingAuthorizeTimeoutSeconds 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 thelocationCollectionEnabled parameter of the airbridge.json file.
AttentionLocation information must be collected for legal purposes only.
Tracking Link Execution
Use the code below to execute and track deep links in the app.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.
AttentionIf you are using a “custom domain” for your tracking link, it can not be used with a “custom short ID”.
- example:
https://deeplink.customdomain.com/custom-> Not possible - example:
https://deeplink.customdomain.co/autogenerated-> Possible - example:
https://abr.ge/autogenerated-> Possible
Get 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+
Send Push Token
registerPushToken method.
Make sure the notification is not shown on the device if the remote message value is airbridge-uninstall-tracking.
Hybrid App Setup
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.
Airbridge.CreateWebInterface allows you to control the web interface.
Please refer to the guide below for more information.
Troubleshooting
Update 1.X.X → 2.X.X
The event API has been replaced to the below.Bitcode Compile Error
An error like below may occur when creating iOS builds with React Native SDK v1.5.0+.Resolve Airbridge SDK backup rules merge conflict issue
- Reference : Android SDK Auto Backup
backup_rules.xml setup
backup_rules.xml setup
- Create a
android/app/src/main/res/xmlfolder. - Within the created xml folder, create a file (e.g.
custom_backup_rules.xml). - Add the data backup rules defined in the Airbridge SDK as follows.
AndroidManifest.xml setup
AndroidManifest.xml setup
Migration guide
Update 1.1.X → 1.2.X
npm
Change version of Airbridge React Native SDK inpackage.json.
Android
- Modify
android/app/src/main/java/.../MainActivity
iOS
- Modify
ios/[Project Name]/AppDelegate
Settings
- Add an
airbridge.jsonfile to the project folder. - Add the parameters shown in the example below in JSON format.
Description
Update 1.0.X → 1.1.X
Installation
Uninstall the old version of the Airbridge SDK.setDeeplinkListener
Remove the getInitialDeeplink function and use the setDeeplinkListener function only.
Android
AndroidManifest.xml
In the MainActivity section of the android/app/src/main/AndroidManifest.xml file, add intent-filter parameters as below.
MainActivity.java
Modify android/app/src/main/java/.../MainActivity.java as below.
iOS
Universal Link
- Go to “Xcode → Project file → Signing & Capabilities”.
- Click ”+ Capability” and add “Associated Domains”.
- Add
applinks:YOUR_APP_NAME.deeplink.pageto “Associated Domains”
YOUR_APP_NAME can be found on the [Settings]>[Token] page in the Airbridge dashboard.AppDelegate.m`
Modifyios/.../AppDelegate.m as below.
Update 0.2.X → 1.X.X
Reinstalling the Airbridge SDK
Unlink the old version of the SDK.react-native unlink react-native-airbridge-bridge
- (Android) Modify
android/app/src/main/java/.../MainApplication.javaas below.
- (iOS) Open
ios/xxx.xcodeproj. - (iOS) Remove
AirbridgeBridge.xcodeprojinLibraries
index.js
Modify index.js as below.
build.gradle (Android)
Modify android/app/build.gradle as below.
AndroidManifest.xml (Android)
Modify android/app/src/main/AndroidManifest.xml as below.
permission (Android)
MainActivity
MainApplication.java (Android)
Modify android/app/src/main/java/.../MainApplication.java as below.
MainActivity.java (Android)
Modify android/app/src/main/java/.../MainActivity.java as below.
Podfile (iOS)
Modify ios/Podfile as below.
AppDelegate.m (iOS)
Modify ios/.../AppDelegate.m as below.