ο»Ώ
(Script tags will be stripped)

## SDK Installation

ο»Ώ

### Package Installation

#### npm

Install `airbridge-react-native-sdk` using npm.

ο»Ώ

#### React-native link or cocoapods

Execute the following command.

ο»Ώ

ο»Ώ

### Project Setup

#### Import

Add the following code to the `index.js` file of the project to import the Airbridge SDK.

ο»Ώ

ο»Ώ

### Project Setup (Android)

#### MainApplication.java

Add the following code to the `onCreate` 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.

ο»Ώ

ο»Ώ

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.

ο»Ώ

`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`

  1. Create an `airbridge.json` file in the project folder.

  2. Configure settings in JSON format.

When using React Native 0.59.X or lower with iOS, the below setup is needed for iOS.

  1. Go to "Xcode β†’ Project file β†’ Build Phases β†’ Copy Bundle Resources".

  2. Click "+" and add airbridge.json file.

#### Example

ο»Ώ

ο»Ώ

`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.

NameTypeDefaultDescription
sessionTimeoutSecondsNumber300An app open event will not be sent when the app is reopened within the designated period.
autoStartTrackingEnabledBooleantrueWhen set to false, no events will be sent until `Airbridge.state.startTracking()` is called.
userInfoHashEnabledBooleantrueWhen set to false, user email and user phone information are sent without being hashed.
trackAirbridgeLinkOnlyBooleanfalseWhen set to true, deep link events are sent only when app is opened with an Airbridge deep link.
facebookDeferredAppLinkEnabledBooleanfalseWhen set to true and the Facebook SDK is installed, Facebook Deferred App Link data is collected.
locationCollectionEnabledBooleanfalseWhen 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
trackingAuthorizeTimeoutSecondsNumber0When timeout is set, Install event is delayed until `Request tracking authorization alert` is clicked. (iOS only)
sdkSignatureSecretIDStringnullProtects against SDK spoofing. Both sdkSignatureSecretID and sdkSignatureSecret values must be applied.
sdkSignatureSecretStringnullProtects against SDK spoofing. Both sdkSignatureSecretID and sdkSignatureSecret values must be applied.
logLevelStringWarningAdjusts 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".

  1. Go to the "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.

<br><br>

## Deep Link Setup

ο»Ώ

### 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.

ο»Ώ

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.

ο»Ώ

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.

ο»Ώ

ο»Ώ

### 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 `://`)

ο»Ώ

#### Universal Link

  1. Go to "Xcode β†’ Project file β†’ Signing & Capabilities".

  2. Click "+ Capability" and add "Associated Domains".

  3. Add `applinks:YOUR_APP_NAME.airbridge.io` to "Associated Domains".

  4. 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

  1. Open `ios/[Project name]/AppDelegate`.

  2. 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.

ο»Ώ
  1. When targeting iOS 8.x or earlier, also call the `handleURLSchemeDeeplink` method at the beginning of the following function.

ο»Ώ
  1. 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.

ο»Ώ

ο»Ώ

### 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

ο»Ώ

### User Identifier Setup

Once a user identifier information is sent to the SDK, all events thereafter will contain the corresponding user identifier information.

NameDescriptionLimitations
IDUser ID-
emailUser EmailHashed by default (SHA256, can be disabled)
phoneUser phone numberHashed by default (SHA256, can be disabled)
attributesUser 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
aliasAnother 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

ο»Ώ

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)' }

ο»Ώ

### 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.

  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 `user` block.

<br><br>

## 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.

ο»Ώ
ο»Ώ
ο»Ώ
`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

ο»Ώ

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 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.

`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.

  1. Send an event with the SDK.

  2. Check if the event shows up at "Airbridge dashboard β†’ Raw Data β†’ Web Real-time Logs".

<br><br>

## Advanced Setup

ο»Ώ

### 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.

ο»Ώ

ο»Ώ

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](πŸ”—ο»Ώ).

  1. Install the Facebook SDK: <https://developers.facebook.com/docs/ios/getting-started>.

  2. 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 links

  • Contains 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.

ο»Ώ

#### `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

ο»Ώ

ο»Ώ

### 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

ο»Ώ

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

ο»Ώ

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 [React Native Hybird App Integration Guide](πŸ”—ο»Ώ) for more information.

<br><br>

## Troubleshooting

ο»Ώ

### Update 1.X.X β†’ 2.X.X

The event API has been replaced to the below.

ο»Ώ

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+.

ο»Ώ

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`.

ο»Ώ

Execute the following command.

ο»Ώ

#### Android

  1. Modify `android/app/src/main/java/.../MainActivity`

ο»Ώ

#### iOS

  1. Modify `ios/[Project Name]/AppDelegate`

ο»Ώ

#### Settings

  1. Add an `airbridge.json` file to the project folder.

  2. Add the parameters shown in the example below in JSON format.

ο»Ώ
##### Description
NameTypeDefaultDescription
sessionTimeoutSecondsnumber300An app open event will not be sent when the app is reopened within the designated period.
autoStartTrackingEnabledbooleantrueWhen set to false, no events will be sent until `airbridge.state.startTracking()` is called.
userInfoHashEnabledbooleantrueWhen set to false, user email and user phone information are sent without being hashed.
trackAirbridgeLinkOnlybooleanfalseWhen set to true, deep link events are sent only when app is opened with an Airbridge deep link.
facebookDeferredAppLinkEnabledbooleanfalseWhen set to true and the Facebook SDK is installed, Facebook Deferred App Link data is collected.
locationCollectionEnabledbooleanfalseWhen 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
trackingAuthorizeTimeoutSecondsnumber0When 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.

ο»Ώ

Install the new version of the Airbridge SDK.

ο»Ώ

After Installation, execute the following command.

ο»Ώ

#### `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.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.

ο»Ώ

When targeting iOS 8.x or earlier, also make the following changes.

ο»Ώ

ο»Ώ

### Update 0.2.X β†’ 1.X.X

#### Reinstalling the Airbridge SDK

Unlink the old version of the SDK.

ο»Ώ

Follow the steps below when an error occurs with `react-native unlink react-native-airbridge-bridge`

  1. (Android) Modify `android/app/src/main/java/.../MainApplication.java` as below.

ο»Ώ
ο»Ώ
  1. (iOS) Open `ios/xxx.xcodeproj`.

  2. (iOS) Remove `AirbridgeBridge.xcodeproj` in `Libraries`

Uninstall the old version of the SDK.

ο»Ώ

Install the new version of the SDK.

ο»Ώ

Link the new version of the SDK.

ο»Ώ

#### `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.

ο»Ώ

Run the command below in terminal.

ο»Ώ

#### `AppDelegate.m` (iOS)

Modify `ios/.../AppDelegate.m` as below.

ο»Ώ
ο»Ώ
ο»Ώ
ο»Ώ

When targeting iOS 8.x or earlier, also make the following changes.

ο»Ώ

ο»Ώ