> ## Documentation Index
> Fetch the complete documentation index at: https://help.airbridge.io/llms.txt
> Use this file to discover all available pages before exploring further.

# DeepLink - React Native SDK

Install the Airbridge React Native SDK and implement the necessary settings following the steps below.

<h2 id="install-sdk">
  Install SDK
</h2>

The Airbridge React Native SDK can be installed using the method below. After installation, you can verify whether the SDK has been properly installed through [testing](#testing).

1. Use npm to install the airbridge-react-native-sdk.

```bash lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
npm install airbridge-react-native-sdk
```

2. Use CocoaPods to install the iOS dependency. The Android dependency is installed automatically.

```bash lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
cd ios; pod install
```

<h3 id="install-restricted-sdk">
  Install Restricted SDK
</h3>

<div id="note" />

<Info>
  **Note**

  Install only one version of the SDK, either the general SDK or the restricted SDK.
</Info>

Depending on policies and environments, restrictions on collecting device IDs like GAID and IDFA may be required. When installing the Restricted SDK version, the device IDs are not collected.

Install the Restricted SDK using the method below.

1. Use npm to install airbridge-react-native-sdk-restricted.

```bash lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
npm install airbridge-react-native-sdk-restricted
```

2. Use CocoaPods to install the iOS dependency. The Android dependency is installed automatically.

```bash lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
cd ios; pod install
```

<h3 id="initialize-sdk">
  Initialize SDK
</h3>

The initialization methods for iOS and Android are different. Refer to the methods described below.

Note that the YOUR\_APP\_NAME and YOUR\_APP\_SDK\_TOKEN can be found on the **\[Settings]>\[Tokens]** page in the Airbridge dashboard.

<h4 id="ios">
  iOS
</h4>

Add the following code to the `ios/YOUR_PROJECT_NAME/AppDelegate.m` file.

<CodeGroup>
  ```swift Swift lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
  import AirbridgeReactNative
  ...
  func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
      AirbridgeReactNative.initializeSDK(name: "YOUR_APP_NAME", token:"YOUR_APP_SDK_TOKEN")
      ...
  }
  ```

  ```objective-c Objective-C lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
  #import <AirbridgeReactNative/AirbridgeReactNative.h>
  ...
  - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
      [AirbridgeReactNative initializeSDKWithName:@"YOUR_APP_NAME" token:@"YOUR_APP_SDK_TOKEN"];
      ...
  }
  ```
</CodeGroup>

<h4 id="android">
  Android
</h4>

Add the following code to the `android/app/src/main/java/.../MainApplication.kt` file.

<CodeGroup>
  ```kotlin Kotlin lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
  import co.ab180.airbridge.reactnative.AirbridgeReactNative
  ...
  override fun onCreate() {
      super.onCreate()
      AirbridgeReactNative.initializeSDK(this, "YOUR_APP_NAME", "YOUR_APP_SDK_TOKEN")
      ...
  }
  ```

  ```java Java lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
  import co.ab180.airbridge.reactnative.AirbridgeReactNative;
  ...
  @Override
  public void onCreate() {
      super.onCreate();
      AirbridgeReactNative.initializeSDK(this, "YOUR_APP_NAME", "YOUR_APP_SDK_TOKEN");
      ...
  }
  ```
</CodeGroup>

<div id="attention" />

<Note>
  **Attention**

  When issues arise due to **Airbridge SDK backup rule merge conflicts**, please refer to the [backup rule configuration](/en/developers/troubleshooting-react-native-sdk-v4#resolve-airbridge-sdk-backup-rules-merge-conflict-issue) in the troubleshooting guide.
</Note>

<h3 id="configure-sdk-settings">
  Configure SDK settings
</h3>

Configure the SDK settings to use the Airbridge React Native SDK.

```json lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
{
    "autoDetermineTrackingAuthorizationTimeoutInSecond": number,
    "isHandleAirbridgeDeeplinkOnly" : boolean
}
```

1. Create an airbridge.json file at the top level of the React Native project folder, input the JSON as above, and configure the SDK settings.

2. Don't input values for keys that are not necessary for your service.

Refer to the links below for detailed guidance on the individual key values.

<Accordion title="References for configuring the SDK settings">
  | Key Value                                         | Reference                                                               |
  | ------------------------------------------------- | ----------------------------------------------------------------------- |
  | autoDetermineTrackingAuthorizationTimeoutInSecond | [Configure ATT prompt](#configure-att-prompt)                           |
  | isHandleAirbridgeDeeplinkOnly                     | [Receive Airbridge Deep Links only](#receive-airbridge-deep-links-only) |
</Accordion>

<h3 id="configure-att-prompt">
  Configure ATT prompt
</h3>

<div id="note-2" />

<Info>
  **Note**

  The functions necessary to ensure compliance with privacy policies should be reviewed with legal counsel.
</Info>

In the iOS environment, the [IDFA](https://developer.apple.com/documentation/adsupport/asidentifiermanager/advertisingidentifier) can only be collected when users provide consent for data tracking through the [App Tracking Transparency (ATT)](https://developer.apple.com/app-store/user-privacy-and-data-use/) prompt.

Event collection should be delayed until the user allows tracking. If the install event is collected before the user allows tracking through the ATT prompt, the install event data will lack an identifier, making performance measurement difficult. We recommend setting a sufficient delay time for event collection to collect identifiers.

1. Prepare the text you will use in the ATT prompt.

2. Provide the ATT prompt following this [guide](https://developer.apple.com/documentation/apptrackingtransparency) provided by Apple.

3. If the install event is not collected, the Airbridge React Native SDK delays collecting install events for 30 seconds until the user allows tracking each time the app is launched. If the user exits the app before deciding whether to allow tracking, the SDK will not collect the install event and will try again at the next app launch.

In the [SDK settings](#configure-sdk-settings), configure the `autoDetermineTrackingAuthorizationTimeout` to set a sufficient delay time for collecting install events. The default value is 30 seconds, and it can be set to up to 3600 seconds (1 hour).

<div id="recommended-time-setting-for-setautodeterminetrackingauthorizationtimeout-function" />

<Note>
  **Recommended time setting for "setAutoDetermineTrackingAuthorizationTimeout" function**

  When using the DeepLink Plan, it is recommended that the `setAutoDetermineTrackingAuthorizationTimeout` parameter be set to 0 seconds when configuring the ATT prompt.

  As the DeepLink Plan does not support attribution using identifiers, the `setAutoDetermineTrackingAuthorizationTimeout` parameter should be set to 0 seconds to seamlessly redirect users who have already installed the app to the intended in-app location as configured in the deferred deep link.
</Note>

<h2 id="deep-linking">
  Deep Linking
</h2>

Deep linking allows you to redirect users from ads to specific locations within your app. The data collected from the tracking link enables you to monitor the performance of the deep link in Airbridge.

<h3 id="how-airbridge-deep-links-work">
  How Airbridge Deep Links work
</h3>

When a user clicks on the Airbridge tracking link, the scheme deep link embedded in the tracking link is converted into an Airbridge Deep Link, which can be either an HTTP deep link or a scheme deep link. This Airbridge Deep Link redirects the user to the desired app location. Then, the Airbridge SDK converts the Airbridge Deep Link back to the original scheme deep link embedded in the tracking link and passes it to the app.

* Example scheme deep link embedded in the tracking link: YOUR\_SCHEME://product/12345
* Examples of Airbridge Deep Links

  * HTTP deep link format 1: https<span>://</span>YOUR\_APP\_NAME.airbridge.io/\~\~\~
  * HTTP deep link format 2: https<span>://</span>YOUR\_APP\_NAME.abr.ge/\~\~\~
  * Scheme deep link format: YOUR\_SCHEME://product/12345?airbridge\_referrer=\~\~\~

When the app is installed on the device and the tracking link is clicked, the app opens through the Airbridge Deep Link. The Airbridge SDK converts the Airbridge Deep Link into the scheme deep embedded in the tracking link and passes it to the app.

When the app is not installed on the device and the tracking link is clicked, the Airbridge SDK saves the Airbridge Deep Link. After the user is redirected to the app store or website and the app is installed and launched, the Airbridge SDK converts the saved Airbridge Deep Link into the scheme deep link embedded in the tracking link and passes it to the app.

<Frame>
  <img src="https://mintcdn.com/airbridge-help-center/Htx4FOCjbD1i8oed/images/ca4fk0iik512/1zFsKkUhhtquqQxMlTXiNm/fef1b56be608e57abea15b0b341acd45/AirbridgeDeeplinkSimpleStructure.drawio.png?fit=max&auto=format&n=Htx4FOCjbD1i8oed&q=85&s=af84ad3d507781bbcaa67fb51910c8f4" alt="Simple structure of Airbridge Deeplink" width="2216" height="748" data-path="images/ca4fk0iik512/1zFsKkUhhtquqQxMlTXiNm/fef1b56be608e57abea15b0b341acd45/AirbridgeDeeplinkSimpleStructure.drawio.png" />
</Frame>

<h3 id="set-up-deep-linking">
  Set up deep linking
</h3>

For the deep linking setup, the deep link information entered to the Airbridge dashboard and the in-app location address for user redirection is required.

First, enter the deep link information into the Airbridge dashboard.

<Accordion title="How to enter the deep link information into Airbridge dashboard">
  For the deep linking setup, the following information must be entered into the Airbridge dashboard.

  #### iOS

  * iOS URI scheme: The Airbridge Deep Link is converted to a scheme deep link using the iOS URI scheme.
  * iOS App ID: The universal link domain of the Airbridge Deep Link is set using the iOS App ID.

  #### Android

  * Android URI scheme: The Airbridge deep link is converted to a scheme deep link using the Android URI scheme. This information is necessary for the App Link and URI scheme.
  * Package name: This is the Android app identifier necessary for the App Link and URI scheme.
  * [Android sha256\_cert\_fingerprints](https://developer.android.com/training/app-links/verify-android-applinks): This is used for setting the App Link domain. This information is necessary for the App Link.

  <div id="attention-2" />

  <Danger>
    **Attention**

    To properly redirect users as intended, submit different information for the production app and the development app.
  </Danger>

  Follow the steps below to submit the necessary information to the Airbridge dashboard.

  #### iOS

  1. Navigate to **\[Tracking Link]>\[Deep Links]** in the Airbridge dashboard.

  2. Enter the iOS URI scheme in the **iOS URI Scheme** field. Include `://`. For example, if the iOS URI scheme is `demo`, enter `demo://`.

  3. In the [Apple Developer Dashboard](https://developer.apple.com/account/resources), navigate to **\[Identifier]** of the app you want to set up the deep link. Find the **App ID Prefix** and **Bundle ID**.

  4. The iOS App ID is in the format of `App ID Prefix+ . + Bundle ID`. Enter the iOS App ID into the **iOS App ID** field. For example, if the App ID Prefix is `prefix` and the Bundle ID is `example`, the iOS App ID is `prefix.example`.

  #### Android

  For apps that use Google Play's Play App Signing, Google's servers re-sign the APK after the developer uploads it. This changes the Android sha256\_cert\_fingerprints, so you must register the final signing value from the Google Play Console—not from your local keystore—for App Links to work correctly. Register the Android URI scheme, package name, and Android sha256\_cert\_fingerprints in Airbridge according to your signing method.

  <Tabs>
    <Tab title="Play App signing">
      1. Naviagate to **\[Tracking Link]>\[Deep Links]** in the Airbridge dashboard.
      2. Enter the Android URI scheme into the **Android URI Scheme** field. Include `://`. For example, if the URI scheme is `demo`, you must enter `demo://`.
      3. Enter the package name in the **Package name** field.
      4. Go to the Google Play Console and select your app.
      5. Navigate to **\[App integrity]**.
      6. Copy the SHA-256 certificate fingerprint from the **App signing key certificate** section.

               <div id="attention-3" />

               <Danger>
                 **Attention**

                 Make sure to copy from the correct section. This page contains two certificate entries:

                 * **App signing key certificate** ← Use this value
                 * **Upload key certificate** ← Do NOT use this value

                 These are two different values. Registering the upload key certificate will cause App Links to stop working.
               </Danger>
      7. Enter the SHA256 value into the **sha256\_cert\_fingerprints** field.
    </Tab>

    <Tab title="using original key">
      1. Naviagate to **\[Tracking Link]>\[Deep Links]** in the Airbridge dashboard.
      2. Enter the Android URI scheme into the **Android URI Scheme** field. Include `://`. For example, if the URI scheme is `demo`, you must enter `demo://`.
      3. Enter the package name in the **Package name** field.
      4. You need to find the sha256\_cert\_fingerprints. Run the following command from the keystore file you are deploying.

         ```bash lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
         keytool -J-Duser.language=en -list -v -keystore YOUR_KEYSTORE.keystore
         ```
      5. Find the SHA256 value in the results. The SHA256 value is the  sha256\_cert\_fingerprints.

         ```bash lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
         Certificate fingerprints:
             MD5:  4C:65:04:52:F0:3F:F8:65:08:D3:71:86:FC:EF:C3:49
             SHA1: C8:BF:B7:B8:94:EA:5D:9D:38:59:FE:99:63:ED:47:B2:D9:5A:4E:CC
             SHA256: B5:EF:4D:F9:DC:95:E6:9B:F3:9A:5E:E9:D6:E0:D8:F6:7B:AB:79:C8:78:67:34:D9:A7:01:AB:6A:86:01:0E:99
         ```
      6. Enter the SHA256 value into the **sha256\_cert\_fingerprints** field.
    </Tab>
  </Tabs>
</Accordion>

After entering the deep link information into the Airbridge dashboard, an additional setup is required to enable the following.

* App launch with Airbridge deep links
* Airbridge deep link event collection
* User redirection with Airbridge deep links

For detailed instructions, refer to the information below.

<AccordionGroup>
  <Accordion title="Enable app launch with Airbridge Deep Links">
    Perform the following setup to enable app launch with Airbridge Deep Links after the user clicks on a tracking link.

    #### iOS

    1. For the scheme deep link setup, navigate to **\[YOUR\_PROJECT]>\[Info]>\[URL Types] i**n Xcode.

    2. Click **+** and enter the iOS URI scheme you submitted to the Airbridge dashboard into the **URL Schemes** field.

    <div id="attention-4" />

    <Danger>
      **Attention**

      When entering the iOS URL scheme, exclude `://`.
    </Danger>

    3. For the Universal Link setup, navigate to **\[YOUR\_PROJECT]>\[Signing & Capabilities]** in Xcode.

    4. Click **+ Capability** to add **Associated Domains**.

    5. Add `applinks:YOUR_APP_NAME.airbridge.io` and `applinks:YOUR_APP_NAME.abr.ge` to Associated Domains.

    YOUR\_APP\_NAME is the App Name.

    <div id="attention-5" />

    <Danger>
      **Attention**

      If you are using or plan to use the [Password AutoFill ](https://developer.apple.com/documentation/security/password-autofill)feature, you must add the Webcredentials domain. A situation may arise where the domain of the password saved through the Password AutoFill feature appears as airbridge.io or abr.ge to your app users.

      Refer to this [article](/en/developers/troubleshooting-ios-sdk-v4#the-domain-of-saved-passwords-appears-as-airbridge-io-or-abr-ge) for more details.
    </Danger>

    #### Android

    1. For the scheme deep link setup, add an intent filter to the Activity that handles deep links in the `AndroidManifest.xml`.

    The intent filter you add must use the Android URI Scheme you submitted to the Airbridge dashboard.

    ```xml lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
    <activity ...>
        ...
        <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="YOUR_SCHEME" />
        </intent-filter>
        ...
    </activity>
    ```

    <div id="attention-6" />

    <Danger>
      **Attention**

      Always use separate `<intent-filter>` tags. If you add all `<data>` tags to a single `<intent-filter>` tag, deep links may not open your app properly.
    </Danger>

    2. For the App Links setup, add an intent filter under the Activity that handles the deep link in the `AndroidManifest.xml`.

    `YOUR_APP_NAME` is the App Name.

    ```xml lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
    <activity ...>
        ...
        <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.abr.ge" />
            <data android:scheme="https" android:host="YOUR_APP_NAME.abr.ge" />
        </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>
        ...
    </activity>
    ```

    <div id="attention-7" />

    <Danger>
      **Attention**

      Always use separate `<intent-filter>` tags. If you add all `<data>` tags to a single `<intent-filter>` tag, deep links may not open your app properly.
    </Danger>
  </Accordion>

  <Accordion title="Enable Airbridge Deep Link event collection">
    To pass the deep link events to the Airbridge SDK, call the `Airbridge.trackDeeplink` function at the top of the OS callback that is called when the app is opened through a deep link.

    #### iOS

    To pass the deep link events to the Airbridge SDK, the Airbridge.trackDeeplink function should be called at the top of the OS callback triggered when the app is opened through a deep link.

    <div id="attention-8" />

    <Note>
      **Attention**

      Starting with the iOS 27 SDK (Xcode 27), apps that do not adopt the UIScene (Scene) lifecycle via UIApplicationSceneManifest will **fail to launch entirely**. In addition, once the Scene lifecycle is adopted, deeplink callbacks that were previously collected automatically through the AppDelegate method will **no longer be called.**
    </Note>

    | Deep link open scenario                                                        | Callback                       |
    | ------------------------------------------------------------------------------ | ------------------------------ |
    | When the app is terminated and opened via a `URL scheme` or a `Universal Link` | `scene:willConnectTo:options:` |
    | When the app is in the background and opened via a `URL scheme`                | `scene:openURLContexts:`       |
    | When the app is in the background and opened via a `Universal Link`            | `scene:continue:`              |

    You can collect deeplinks in SceneDelegate using the code below.

    <CodeGroup>
      ```swift Swift lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
      import AirbridgeReactNative

      // when terminated app is opened with scheme deeplink or universal links
      func scene(_ scene: UIScene,
                 willConnectTo session: UISceneSession,
                 options connectionOptions: UIScene.ConnectionOptions) {
          guard let windowScene = scene as? UIWindowScene else { return }
          
          // track deeplink
          AirbridgeReactNative.trackDeeplink(connectionOptions: connectionOptions)
      }

      // when backgrounded app is opened with scheme deeplink
      func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
          // track deeplink
          AirbridgeReactNative.trackDeeplink(openURLContexts: URLContexts)
      }

      // when backgrounded app is opened with universal links
      func scene(_ scene: UIScene, continue userActivity: NSUserActivity) {
          // track deeplink
          AirbridgeReactNative.trackDeeplink(userActivity: userActivity)
      }
      ```

      ```objective-c Objective-C lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
      #import <AirbridgeReactNative/AirbridgeReactNative.h>

      // when terminated app is opened with scheme deeplink or universal links
      - (void)scene:(UIScene *)scene
          willConnectToSession:(UISceneSession *)session
                       options:(UISceneConnectionOptions *)connectionOptions
      {
        // track deeplink
        [AirbridgeReactNative trackDeeplinkWithConnectionOptions:connectionOptions];
      }

      // when backgrounded app is opened with scheme deeplink
      - (void)scene:(UIScene *)scene openURLContexts:(NSSet<UIOpenURLContext *> *)URLContexts
      {
        // track deeplink
        [AirbridgeReactNative trackDeeplinkWithOpenURLContexts:URLContexts];
      }

      // when backgrounded app is opened with universal links
      - (void)scene:(UIScene *)scene continueUserActivity:(NSUserActivity *)userActivity
      {
        // track deeplink
        [AirbridgeReactNative trackDeeplinkWithUserActivity:userActivity];
      }
      ```
    </CodeGroup>

    #### Android

    Add the following code to the `android/app/src/main/java/.../MainActivity.kt` file.

    <CodeGroup>
      ```kotlin Kotlin lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
      import co.ab180.airbridge.reactnative.AirbridgeReactNative
      ...
      override fun onResume() {
          super.onResume()
          AirbridgeReactNative.trackDeeplink(intent)
      }
      ...
      override fun onNewIntent(intent: Intent?) {
          super.onNewIntent(intent)
          setIntent(intent)
      }
      ```

      ```java Java lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
      import co.ab180.airbridge.reactnative.AirbridgeReactNative;
      ...
      @Override
      protected void onResume() {
          super.onResume();
          AirbridgeReactNative.trackDeeplink(getIntent());
      }
      ...
      @Override
      public void onNewIntent(Intent intent) {
          super.onNewIntent(intent);
          setIntent(intent);
      }
      ```
    </CodeGroup>
  </Accordion>

  <Accordion title="Enable user redirection with Airbridge Deep Links">
    When an Airbridge Deep Link is executed, it is converted into a scheme deep link and passed to the `OnDeeplinkReceived` callback. If a deep link that is not an Airbridge Deep Link is executed, the deep link is passed directly to the callback without any conversion.

    Use the deep link passed to the callback to redirect the user to the intended destination.

    ```typescript lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
    import { Airbridge } from 'airbridge-react-native-sdk'
    ...
    Airbridge.setOnDeeplinkReceived((url) => {
        // show proper content using url
    })
    ```
  </Accordion>
</AccordionGroup>

<h3 id="set-up-deferred-deep-linking">
  Set up deferred deep linking
</h3>

When a user clicks on a tracking link with deferred deep linking capabilities and your app is not installed on the device, the Airbridge SDK retrieves the deep link as follows.

<Accordion title="How the Airbridge SDK collects deferred deep links">
  The Airbridge SDK attempts to collect a deep link after initializing the SDK when all the following conditions are met. If the app is closed during collection, the Airbridge SDK treats it as if there is no stored Airbridge deep link.

  * The `Airbridge.startTracking` function is called with the opt-in settings in place. Or, opt-in has not been set.
  * The ATT tracking response has been determined. Or, the event collection delay time set in the ATT prompt has expired.
</Accordion>

Deferred deep links are automatically passed to `OnDeeplinkReceived`, so no additional setup is required.

<h2 id="testing">
  Testing
</h2>

The SDK functionality test and deep link test allow you to check whether the SDK and deep linking work as intended.

* [Testing - iOS](/en/deeplink-developers/ios-sdk-v4#testing)
* [Testing - Android](/en/deeplink-developers/android-sdk-v4#testing)

<h2 id="additional-sdk-settings">
  Additional SDK Settings
</h2>

Follow the instructions below for additional setup.

<div id="attention-9" />

<Info>
  **Attention**

  Optional settings. Configure only if necessary.
</Info>

<h3 id="receive-airbridge-deep-links-only">
  Receive Airbridge Deep Links only
</h3>

<div id="note-3" />

<Info>
  **Note**

  The Airbridge Flutter SDK must be v4.1.2 or later.
</Info>

The deep links passed through the `setOnDeeplinkReceived` method of the Airbridge React Native SDK include not only Airbridge Deep Links but also deep links from other solutions.

```dart lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
import 'package:airbridge_flutter_sdk/airbridge_flutter_sdk.dart';
...
Airbridge.setOnDeeplinkReceived((url) {
    // show proper content using url
});
```

By configuring `isHandleAirbridgeDeeplinkOnly` to `true` in the [SDK settings](#configure-sdk-settings), only Airbridge Deep Links will be passed to the `setOnDeeplinkReceived` callback. In this way, you can handle the deep links from other solutions separately from the Airbridge Deep Links.

<h3 id="create-tracking-links-within-the-app">
  Create tracking links within the app
</h3>

<div id="attention-10" />

<Info>
  **Attention**

  React Native SDK v.4.3.0 or later is required.
</Info>

Tracking links are links that are embedded to ads for data collection. When users click on the ad, the tracking link is used to pass the touchpoint data to Airbridge, allowing for ad attribution.

Also, users who click on the ad with a tracking link can be redirected to a specific destination.

Use the `createTrackingLink` function to create tracking links. Refer to the code examples and the parameter details below.

```typescript lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
static createTrackingLink(
    channel: string,
    option: Record<string, any>,
    onSuccess: (airbridgeTrackingLink: AirbridgeTrackingLink) => void,
    onFailure?: (error: Error) => void
): void
```

| Name      | Required or Optional | Type                                                   | Description                              |
| --------- | -------------------- | ------------------------------------------------------ | ---------------------------------------- |
| channel   | Required             | String                                                 | The ad channel the tracking link is used |
| option    | Require              | Record\<String, Object>                                | Options for creating tracking links      |
| onSuccess | Required             | (airbridgeTrackingLink: AirbridgeTrackingLink) => void | Success callback                         |
| onFailure | Optional             | (error: Error) => void                                 | Fail callback                            |

Use the `option` parameter in the `createTrackingLink` function to configure tracking link options.

<Accordion title="Create trackingLink option">
  <div style={{ overflowX: 'auto' }}>
    <table style={{ display: 'table' }}>
      <thead>
        <tr>
          <th>
            Key
          </th>

          <th>
            Type
          </th>

          <th>
            Description
          </th>
        </tr>
      </thead>

      <tbody>
        <tr>
          <td>
            AirbridgeTrackingLinkOption.CAMPAIGN
          </td>

          <td>
            String
          </td>

          <td>
            The campaign credited with the winning touchpoint or conversion.
          </td>
        </tr>

        <tr>
          <td>
            AirbridgeTrackingLinkOption.AD\_GROUP
          </td>

          <td>
            String
          </td>

          <td>
            The ad group credited with the winning touchpoint or conversion.
          </td>
        </tr>

        <tr>
          <td>
            AirbridgeTrackingLinkOption.AD\_CREATIVE
          </td>

          <td>
            String
          </td>

          <td>
            The ad creative credited with the winning touchpoint or conversion.
          </td>
        </tr>

        <tr>
          <td>
            AirbridgeTrackingLinkOption.CONTENT
          </td>

          <td>
            String
          </td>

          <td>
            The content credited with the winning touchpoint or conversion.
          </td>
        </tr>

        <tr>
          <td>
            AirbridgeTrackingLinkOption.TERM
          </td>

          <td>
            String
          </td>

          <td>
            The search term credited with the winning touchpoint or conversion.
          </td>
        </tr>

        <tr>
          <td>
            AirbridgeTrackingLinkOption.SUB\_ID
          </td>

          <td>
            String
          </td>

          <td>
            The sub publisher that generated the touchpoint.<br />Sub media values are usually provided by predefined "integrated" channels.
          </td>
        </tr>

        <tr>
          <td>
            AirbridgeTrackingLinkOption.SUB\_ID\_1
          </td>

          <td>
            String
          </td>

          <td>
            The 1st level sub-sub publisher that generated the touchpoint.<br />Sub media values are usually provided by predefined "integrated" channels.
          </td>
        </tr>

        <tr>
          <td>
            AirbridgeTrackingLinkOption.SUB\_ID\_2
          </td>

          <td>
            String
          </td>

          <td>
            The 2nd level sub-sub publisher that generated the touchpoint.<br />Sub media values are usually provided by predefined "integrated" channels.
          </td>
        </tr>

        <tr>
          <td>
            AirbridgeTrackingLinkOption.SUB\_ID\_3
          </td>

          <td>
            String
          </td>

          <td>
            The 3rd level sub-sub publisher that generated the touchpoint.<br />Sub media values are usually provided by predefined "integrated" channels.
          </td>
        </tr>

        <tr>
          <td>
            AirbridgeTrackingLinkOption.DEEPLINK\_URL
          </td>

          <td>
            (Custom Scheme URL String)
          </td>

          <td>
            Deeplink URL
          </td>
        </tr>

        <tr>
          <td>
            AirbridgeTrackingLinkOption.DEEPLINK\_STOPOVER
          </td>

          <td>
            Boolean
          </td>

          <td>
            Whether to enable the stopover feature of Deeplink<br />true : enable<br />false : disable
          </td>
        </tr>

        <tr>
          <td>
            AirbridgeTrackingLinkOption.FALLBACK\_IOS
          </td>

          <td>
            ("store" | Web URL String)
          </td>

          <td>
            ios fallback when app is not installed
          </td>
        </tr>

        <tr>
          <td>
            AirbridgeTrackingLinkOption.FALLBACK\_ANDROID
          </td>

          <td>
            ("store" | Web URL String)
          </td>

          <td>
            android fallback when app is not installed
          </td>
        </tr>

        <tr>
          <td>
            AirbridgeTrackingLinkOption.FALLBACK\_DESKTOP
          </td>

          <td>
            (Web URL String)
          </td>

          <td>
            desktop fallback when app is not installed
          </td>
        </tr>

        <tr>
          <td>
            AirbridgeTrackingLinkOption.FALLBACK\_IOS\_STORE\_PPID
          </td>

          <td>
            String
          </td>

          <td>
            The ppid for the Custom Product Page in the Apple App Store.<br />Enable the custom product page to be shown when landing in the App Store.
          </td>
        </tr>

        <tr>
          <td>
            AirbridgeTrackingLinkOption.FALLBACK\_ANDROID\_STORE\_LISTING
          </td>

          <td>
            String
          </td>

          <td>
            The Custom Store Listing listing value for the Google Play Store.<br />Enables the display of your custom store listing when landing on the Google Play Store.
          </td>
        </tr>

        <tr>
          <td>
            AirbridgeTrackingLinkOption.OGTAG\_TITLE
          </td>

          <td>
            String
          </td>

          <td>
            `og:title` for tracking link
          </td>
        </tr>

        <tr>
          <td>
            AirbridgeTrackingLinkOption.OGTAG\_DESCRIPTION
          </td>

          <td>
            String
          </td>

          <td>
            `og:description` for tracking link
          </td>
        </tr>

        <tr>
          <td>
            AirbridgeTrackingLinkOption.OGTAG\_IMAGE\_URL
          </td>

          <td>
            (Web URL String)
          </td>

          <td>
            `og:image` for tracking link
          </td>
        </tr>

        <tr>
          <td>
            AirbridgeTrackingLinkOption.OGTAG\_WEBSITE\_CRAWL
          </td>

          <td>
            ("desktop")
          </td>

          <td>
            When the tracking link is shared, the social media platform directly crawls the Open Graph of the desktop URL specified in fallbackPaths and uses it for the social share preview. Dynamic URLs are also supported, and any change to the Open Graph is reflected automatically from the next time the link is shared. The values set for title, description, and imageUrl will be ignored.
          </td>
        </tr>

        <tr>
          <td>
            AirbridgeTrackingLinkOption.CUSTOM\_SHORT\_ID
          </td>

          <td>
            String
          </td>

          <td>
            Configure the short ID of tracking links depending on your campaign or contents.<br />If not passed, a random short ID will be generate, and can not be changed once generated.
          </td>
        </tr>

        <tr>
          <td>
            AirbridgeTrackingLinkOption.IS\_REENGAGEMENT
          </td>

          <td>
            ("off" | "on\_true" | "on\_false")
          </td>

          <td>
            Configure the Re-engagement parameter. The Re-engagement parameter has three options.<br />off: OFF is the default setting. The touchpoint can be attributed to both install events and post-install events (in-app events).<br />on\_true: ON-TRUE is used for re-engagement campaigns for installed users. The touchpoint generated by the tracking link is attributed only to the deeplink open and the following in-app events, not to the install event.<br />on\_false: ON-FALSE is used for user acquisition campaigns targeting uninstalled users. The touchpoint generated by the tracking link is attributed only to the install event and the following in-app events, not to the 'deeplink open' event.
          </td>
        </tr>
      </tbody>
    </table>
  </div>
</Accordion>

Use the `onSuccess` callback in the `createTrackingLink` function to pass the `AirbridgeTrackingLink`.

```typescript lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
/**
 * Holds variable types of tracking-link that move user
 * to specific page of app and track click-event.
 */
export type AirbridgeTrackingLink = {
    /// A tracking-link url contains short mapping-id of option
    shortURL: string
    /// A qrcode image-url of tracking-link
    qrcodeURL: string
}
```

| Name      | Type   | Description                          |
| --------- | ------ | ------------------------------------ |
| shortURL  | String | The short URL of the tracking link   |
| qrcodeURL | String | The QR code URL of the tracking link |

Refer to the example codes below.

<AccordionGroup>
  <Accordion title="Create tracking links that launch the app or redirect users to the app store">
    ```typescript lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
    Airbridge.createTrackingLink(
        "test_channel",
        {
            [AirbridgeTrackingLinkOption.CAMPAIGN]: 'test_campaign',
            [AirbridgeTrackingLinkOption.DEEPLINK_URL]: 'YOUR_SCHEME://...',
            [AirbridgeTrackingLinkOption.FALLBACK_IOS]: 'store',
            [AirbridgeTrackingLinkOption.FALLBACK_ANDROID]: 'store',
            [AirbridgeTrackingLinkOption.FALLBACK_DESKTOP]: 'https://example.com/'
        },
        (trackingLink) => {
            // Handling created tracking-link
        },
        (error) => {
            // Handling error
        }
    )
    ```
  </Accordion>

  <Accordion title="Create tracking links that launch the app or redirect users to a webpage">
    ```typescript lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
    Airbridge.createTrackingLink(
        "test_channel",
        {
            [AirbridgeTrackingLinkOption.CAMPAIGN]: 'test_campaign',
            [AirbridgeTrackingLinkOption.DEEPLINK_URL]: 'sample://home',
            [AirbridgeTrackingLinkOption.FALLBACK_IOS]: 'https://example.com/',
            [AirbridgeTrackingLinkOption.FALLBACK_ANDROID]: 'https://example.com/',
            [AirbridgeTrackingLinkOption.FALLBACK_DESKTOP]: 'https://example.com/'
        },
        (trackingLink) => {
            // Handling created tracking-link
        },
        (error) => {
            // Handling error

        }
    )
    ```
  </Accordion>

  <Accordion title="Create tracking links that redirect users to the app store only">
    ```typescript lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
    Airbridge.createTrackingLink(
        "test_channel",
        {
            [AirbridgeTrackingLinkOption.CAMPAIGN]: 'test_campaign',
            [AirbridgeTrackingLinkOption.FALLBACK_IOS]: 'store',
            [AirbridgeTrackingLinkOption.FALLBACK_ANDROID]: 'store',
            [AirbridgeTrackingLinkOption.FALLBACK_DESKTOP]: 'https://example.com/'
        },
        (trackingLink) => {
            // Handling created tracking-link
        },
        (error) => {
            // Handling error
        }
    )
    ```
  </Accordion>

  <Accordion title="Create tracking links that redirect users to a webpage only">
    ```typescript lines theme={"theme":{"light":"github-dark-dimmed","dark":"github-dark-dimmed"}}
    Airbridge.createTrackingLink(
        "test_channel",
        {
            [AirbridgeTrackingLinkOption.CAMPAIGN]: 'test_campaign',
            [AirbridgeTrackingLinkOption.FALLBACK_IOS]: 'https://example.com/',
            [AirbridgeTrackingLinkOption.FALLBACK_ANDROID]: 'https://example.com/',
            [AirbridgeTrackingLinkOption.FALLBACK_DESKTOP]: 'https://example.com/'
        },
        (trackingLink) => {
            // Handling created tracking-link
        },
        (error) => {
            // Handling error
        }
    )
    ```
  </Accordion>
</AccordionGroup>

<link rel="alternate" hrefLang="en" href="https://help.airbridge.io/en/deeplink-developers/react-native-sdk-v4" />

<link rel="alternate" hrefLang="ko" href="https://help.airbridge.io/ko/deeplink-developers/react-native-sdk-v4" />
