Expo SDK

    SDK Installation


    Package Installation

    Install airbridge-expo-sdk and airbridge-react-native-sdk using npm.

    12
    npm install --save airbridge-expo-sdk@2.6.4
    npm install --save airbridge-react-native-sdk@2.8.3

    Attention

    Airbridge Expo SDK does not support expo go environments. Please use it with expo prebuild or eas build.

    Project Setup

    app.json

    Add following setting to your app.json file.

    123456789101112131415
    {
      "expo": {
        ...
        "plugins": [
          ...
          [
            "airbridge-expo-sdk",
            {
              "appName": "APP_NAME",
              "appToken": "APP_TOKEN"
            }
          ]
        ]
      }
    }

    Attention

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

    airbridge.json

    1. Create an airbridge.jsonfile in the project folder.

    2. Configure settings in JSON format.

    Example

    123456789101112
    {
        "sessionTimeoutSeconds": 300,
        "autoStartTrackingEnabled": true,
        "userInfoHashEnabled": true,
        "trackAirbridgeLinkOnly": false,
        "facebookDeferredAppLinkEnabled": false,
        "locationCollectionEnabled": false,
        "trackingAuthorizeTimeoutSeconds": 30,
        "sdkSignatureSecretID": "YOUR_SDK_SIGNATURE_SECRET_ID",
        "sdkSignatureSecret": "YOUR_SDK_SIGNATURE_SECRET",
        "logLevel": "warning"
    }

    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 timeout is set, Install event is delayed until Request tracking authorization alertis 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".

    1. Go to "Airbridge Dashboard → Raw Data → App Real-time Logs".

    2. Search for the device's ADID (IDFA, IDFV, GAID).

    Attention

    Logs may be delayed for up to 5 minutes.


    Dashboard Setup

    Please refer to the guides below to setup your deep links in the Airbridge dashboard.

    • iOS Deep Link Dashboard Setup Guide

    • Android Deep Link Dashboard Setup Guide

    Project Setup

    app.json

    Add the following settings to your app.json file.

    12345678910111213141516171819202122232425262728293031323334353637
    {
      "expo": {
        ...
        "scheme": "YOUR_SCHEME",
        "android": {
          ...
          "intentFilters": [{
            "autoVerify": true,
            "action": "VIEW",
            "data": { "scheme": "https", "host": "APP_NAME.airbridge.io" },
            "category": ["BROWSABLE", "DEFAULT"]
          }, {
            "autoVerify": true,
            "action": "VIEW",
            "data": { "scheme": "https", "host": "APP_NAME.deeplink.page" },
            "category": ["BROWSABLE", "DEFAULT"]
          }, {
            "autoVerify": true,
            "action": "VIEW",
            "data": { "scheme": "http", "host": "APP_NAME.airbridge.io" },
            "category": ["BROWSABLE", "DEFAULT"]
          }, {
            "autoVerify": true,
            "action": "VIEW",
            "data": { "scheme": "http", "host": "APP_NAME.deeplink.page" },
            "category": ["BROWSABLE", "DEFAULT"]
          }]
        },
        "ios": {
          ...
          "associatedDomains": [
            "applinks:APP_NAME.airbridge.io",
            "applinks:APP_NAME.deeplink.page"
          ]
        }
      }
    }

    YOUR_SCHEME can be found at the "Airbridge dashboard → Tracking Link → Deep Link → URI Scheme".

    setDeeplinkListener

    Register a function that will be called whenever a deep link or a deferred deep link opens the application.

    1234567
    import Airbridge from 'airbridge-react-native-sdk'
    
    Airbridge.deeplink.setDeeplinkListener((deeplink) => {
        // code that will run when app is opened with deep-link or deferred-deep-link
        // deeplink = YOUR_SCHEME://...
        console.log(deeplink)
    })

    Attention

    If you call setDeeplinkListener multiply, only last listener will receive deeplink.

    Custom Domain Setup (Optional)

    app.json

    Add the following settings to your app.json file.

    12345678910111213141516171819202122232425262728293031323334353637
    {
      "expo": {
        ...
        "android": {
          ...
          "intentFilters": [{
            "autoVerify": true,
            "action": "VIEW",
            "data": { "scheme": "https", "host": "YOUR_DOMAIN.YOUR_DOMAIN.example" },
            "category": ["BROWSABLE", "DEFAULT"]
          }, {
            "autoVerify": true,
            "action": "VIEW",
            "data": { "scheme": "http", "host": "YOUR_DOMAIN.YOUR_DOMAIN.example" },
            "category": ["BROWSABLE", "DEFAULT"]
          }]
        },
        "ios": {
          ...
          "associatedDomains": [
            "applinks:YOUR_DOMAIN.YOUR_DOMAIN.example"
          ]
        },
        "plugins": [
          ...
          [
            "airbridge-expo-sdk",
            {
              ...
              "customDomains": [
                "YOUR_DOMAIN.YOUR_DOMAIN.example"
              ]
            }
          ]
        ]
      }
    }

    YOUR_DOMAIN.YOUR_DOMAIN.example can be found at the "Airbridge dashboard → Tracking Link → Domain Setting → Custom Domain".

    Click on your URI scheme to test if your deep link has been properly set up in the Airbridge SDK.

    • YOUR_SCHEME://

    The results will show on the "Airbridge dashboard → Raw Data → App Real-time Log" tab if everything is working.

    User Setup


    Please refer to this guide.

    Device Setup


    Please refer to this guide.

    Event Setup


    Please refer to this guide.

    Advanced Setup


    SDK Signature Setup

    Protection against SDK spoofing is possible once you set your SDK Signature.
    This feature is available for the Airbridge Expo SDK v2.2.0 and Airbridge React Native SDK v2.3.0 and above.

    Add the following lines in the airbridge.json file.

    1234
    {
        "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.

    Other Advanced Settings

    Please refer to this guide.

    Troubleshooting


    Update v1.X.X → v2.0.0

    The previous event API has been deprcated and replaced with the new API below.

    123456
    /**
     * Send event to server.
     * @param {string} category event name
     * @param {EventOption} [option={}] event options
     */
    trackEvent(category: string, option?: EventOption): void;

    Refer to the Expo SDK 2.1.0 Migration Guide for details.

    Was this page helpful?

    Have any questions or suggestions?