Skip to main content

SDK Installation


Package Installation

plugin add
Cordova: cordova plugin add airbridge-cordova-sdk Ionic: ionic cordova plugin add airbridge-cordova-sdk PhoneGap: phonegap plugin add airbridge-cordova-sdk For Ionic projects, please add the following code to the .ts files that will be using the Airbridge SDK.

Project Setup (Android)

MainApplication.java
Initialize the Airbridge SDK in the Android Application class.
  1. Create an Application class. Add the platforms/android/app/src/main/java/[PACKAGE NAME]/MainApplication.java file.
If you already have the Application class, proceed to step 3.
  1. Set the created Application in the AndroidManifest.xml.
AndroidManifest.xml
  1. Add the following initialization code to the Application class.
‘YOUR_APP_NAME’ is your app name. You can find app name in the Airbridge dashboard under [Settings]>[App Settings]. ‘YOUR_APP_SDK_TOKEN’ is App SDK token. You can find your App SDK token under [Settings] > [Tokens].

Project Setup (iOS)

AppDelegate.m
Add the following code to the import section of the file ios/[Project Name]/AppDelegate.m.
Add the following code to the application:idFinishLaunchingWithOptions: function within the ios/[Project Name]/AppDelegate.m file.
APP_NAME can be found on the dashboard at Settings → Tokens → App Name. APP_TOKEN can be found on the dashboard at Settings → Tokens → App SDK Token.

Common Settings

airbridge.json
  1. Add an airbridge.jsonfile to the project folder.
  2. Configure settings in JSON format.
AttentiontrackingAuthorizeTimeoutSeconds in the above code is the default value (0). Please adjust accordingly depending on your user experience and ATT prompt settings. 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”.
  1. Go to Airbridge Dashboard → Raw Data → App Real-time Logs.
  2. Search for the device’s ADID (IDFA, IDFV, GAID).
Logs may be delayed for up to 5 minutes.

Dashboard Setup

Please refer to the following guides for setting up deep links in the Airbridge dashboard.

Project Setup (Android)

setDeeplinkListener
Register a function that will be called whenever a “deep link” or a “deferred deep link” opens the application.
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.
AndroidManifest.xml
In the MainActivity section of the android/app/src/main/AndroidManifest.xml file, add intent-filter parameters as below.
Enter your app name at APP_NAME. Enter your scheme value set in the Airbridge dashboard at YOUR_SCHEME.
MainActivity.java
Insert the following code in the android/app/src/main/java/.../MainActivity.java file.

Project Setup (iOS)

Scheme
  1. Go to “Xcode → Project file → Info → URL Types”.
  2. From the Airbridge dashboard, copy “iOS URI Scheme” to Xcode’s “URL Schemes”. (Do not include://)
  1. Go to “Xcode → Project file → Signing & Capabilities”.
  2. Click ”+ Capability” and add “Associated Domains”.
  3. Add applinks:YOUR_APP_NAME.airbridge.ioto “Associated Domains”.
  4. 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 deeplink information to SDK
  1. Open ios/[Project name]/AppDelegate.
  2. Send deeplink information to the SDK when the application is opened through schemes by calling the handleURLSchemeDeeplinkmethod at the beginning of the following function.
  1. When targeting iOS 8.x or earlier, also call the handleURLSchemeDeeplinkmethod at the beginning of the following function.
  1. Send deeplink 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. 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.

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
The above code operates in the following order.
  1. User = { ID: ‘personID1’, email: ‘persondoe1@airbridge.io’ }
  2. User = { ID: ‘personID1’, email: ‘persondoe1@airbridge.io’, phone: ‘1(123)123-1234’ }
  3. User = { ID: ‘personID3’, email: ‘persondoe2@airbridge.io’, phone: ‘1(123)123-1234)’ }

Testing

Make sure that your user information settings are being properly sent through the SDK.
  1. Configure user identifier information.
  2. Send an event using the SDK.
  3. Click the event at “Airbridge dashboard → Raw Data → App Real-time Logs”
  4. 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.j

Event Setup


When important user actions occur, in-app events can be sent to measure performance by channel. All event parameters are optional. However, more information about the event will help provide a more accurate analysis. actionlabelvaluecustomAttributes and semanticAttributes can be used for event options.

User Events

Send standard user events with the SDK. actionlabelvaluecustomAttributes 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.
Sign In
User identifiers are set with setUser and then sent with AirbridgeCategory.SIGN_IN for user logins.
Sign Out
Send the sign out event with AirbridgeCategory.SIGN_OUT, and then reset the user identifiers with Airbridge.state.setUser({}).

E-commerce Events

Send e-commerce events with the SDK.
actionlabelvaluecustomAttributes 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.
  1. Send an event with the SDK.
  2. Check if the event shows up at “Airbridge dashboard → Raw Data → App Real-time Logs”.

Advanced Setup


Please refer to the below guides for advanced settings.

SDK Signature Setup

Protection against SDK spoofing is possible once you set your SDK Signature. This feature is available for the Airbridge Cordova SDK v2.2.0 and above.
  • Add the following lines in the airbridge.json file.
Please ask your CSM for the “SDK Signature Secret ID” and “SDK Signature Secret” values.

Braze Integration

Use the SDK to SDK method to automatically send Airbridge attribution information to Braze. Please refer to the Braze integration guide for more details.
iOS
Modify ios/[Project name]/AppDelegate.m as below.
Android
Modify android/app/src/main/java/.../MainApplication.java as below.
The code related to the Airbridge-Braze integration should be written under Braze init.

Uninstall Tracking

This feature is available only for Codova Ionic PhoneGap SDK v2.1.0+.
  • Airbridge Android SDK v2.6.0+
  • Airbridge iOS SDK v1.28.2+
Please refer to Android Guide and iOS Guide for details.
Send Push 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.

Troubleshooting


Update 1.X.X → 2.X.X

The event API has been replaced to the below.
Refer to the Cordova 2.X.X migration guide for details.

Bitcode Compile Error

An error like below may occur when creating iOS builds with Cordova Ionic PhoneGap SDK v2.0.1+.
Since Cordova Ionic PhoneGap SDK v2.0.1+ 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

Uninstall the old version of the Airbridge SDK. Cordova: cordova plugin remove airbridge-cordova-sdk Ionic: ionic cordova plugin remove airbridge-cordova-sdk PhoneGap: phonegap plugin remove airbridge-cordova-sdk Install the new version of the Airbridge SDK. Cordova: cordova plugin add airbridge-cordova-sdk Ionic: ionic cordova plugin add airbridge-cordova-sdk PhoneGap: phonegap plugin add airbridge-cordova-sdk
Android
Modify android/app/src/main/java/.../MainActivity as below.
iOS
Modify ios/[Project Name]/AppDelegate as below.
Settings
  1. Add an airbridge.jsonfile to the project folder.
  2. Add the parameters shown in the example below in JSON format.
Example
Description

Update 1.0.X → 1.1.X

Install
Uninstall the old version of the Airbridge SDK. Cordova: cordova plugin remove airbridge-cordova-sdk Ionic: ionic cordova plugin remove airbridge-cordova-sdk PhoneGap: phonegap plugin remove airbridge-cordova-sdk Install the new version of the Airbridge SDK. Cordova: cordova plugin add airbridge-cordova-sdk Ionic: ionic cordova plugin add airbridge-cordova-sdk PhoneGap: phonegap plugin add airbridge-cordova-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
  1. Go to “Xcode → Project file → Signing & Capabilities”.
  2. Click ”+ Capability” and add “Associated Domains”.
  3. Add applinks:YOUR_APP_NAME.deeplink.pageto “Associated Domains”.
YOUR_APP_NAME can be found at the “Airbridge dashboard → Settings → Tokens → App Name”. AppDelegate.m Modify ios/.../AppDelegate.m as below.
When targeting iOS 8.x or earlier, also make the following changes.