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

# Braze

> Connect Linkrunner with Braze to import attribution data and understand your user acquisition campaigns

Linkrunner integrates with Braze to automatically send attribution data, helping you understand which campaigns are driving user acquisition and engagement.

## How it works

Every time a user is attributed by Linkrunner, we automatically send a request to Braze to update the corresponding user's profile with custom attributes:

* `lr_campaign` - The campaign identifier
* `lr_ad_network` - The ad network source

### Example

* User ID `24` came from campaign link: `https://app.linkrunner.io/?c=AXb1c2`
* In Braze, for user profile with ID `24`, you'll see `lr_campaign` set to `AXb1c2` and `lr_ad_network` set to an ad network source

The data will be visible in the **Custom Attributes** section of the user profile in the Braze dashboard.

## Prerequisites

| Requirement        | Description                                                              |
| ------------------ | ------------------------------------------------------------------------ |
| Linkrunner account | A Linkrunner account is required to take advantage of this integration.  |
| Braze account      | A Braze account with API access.                                         |
| iOS or Android app | This integration supports iOS and Android apps.                          |
| Linkrunner SDK     | You must have the [Linkrunner SDK](/introduction) installed in your app. |

## Steps to setup

<Steps>
  <Step title="Create API Key in Braze and Configure in Linkrunner">
    First, you need to create an API key in your Braze dashboard with the required permissions.

    1. In your Braze dashboard, navigate to **Settings** > **Setup and Testing** > **APIs and Identifiers** > **API Keys**
           <img src="https://mintcdn.com/linkrunner-01ef8e08/EPrnwII1nAoMH-jn/images/braze/braze_1.png?fit=max&auto=format&n=EPrnwII1nAoMH-jn&q=85&s=7f54cb25daa6a66f4aa52417b8f253f3" alt="Braze API Keys" width="2990" height="1684" data-path="images/braze/braze_1.png" />

    2. Click **Create API Key**

    3. Under permissions, select the following under **User Data**:
       * `users.track`
       * `users.export.ids`

    4. Save the API key

    5. Copy the **API Key** and **REST Endpoint** from the Braze dashboard
           <img src="https://mintcdn.com/linkrunner-01ef8e08/EPrnwII1nAoMH-jn/images/braze/braze_2.png?fit=max&auto=format&n=EPrnwII1nAoMH-jn&q=85&s=7a4dc807a4bde8c9bf82e66411a40b1e" alt="Braze REST Endpoint" width="3006" height="1700" data-path="images/braze/braze_2.png" />

    6. In Linkrunner, navigate to **Integrations** from the left-hand panel

    7. Under **Analytics**, click **Configure** for Braze

    8. Enter your **API Key** and **REST Endpoint** (e.g., `https://rest.iad-01.braze.com`)
  </Step>

  <Step title="Map User Identifiers in SDK">
    To properly link users between Linkrunner and Braze, you need to pass the correct identifier in the `signup` function.

    <Info>
      **Important:** If you are using the `changeUser` function of the Braze SDK, pass the same user ID in the `userData` parameter of the Linkrunner `signup` function. If you are not using `changeUser`, pass the `brazeDeviceId` instead.
    </Info>

    <Tabs>
      <Tab title="Android (Kotlin)">
        ```kotlin theme={null}
        import io.linkrunner.sdk.LinkRunner
        import io.linkrunner.sdk.models.request.UserDataRequest

        val userData = UserDataRequest(
            id = "123", // Your user ID
            // ...other user fields
            brazeDeviceId = "BRAZE_DEVICE_ID", // Required if not using changeUser
        )

        LinkRunner.getInstance().signup(userData = userData)
        ```
      </Tab>

      <Tab title="iOS (Swift)">
        ```swift theme={null}
        import Linkrunner

        let userData = UserData(
            id: "123", // Your user ID
            // ...other user fields
            brazeDeviceId: "BRAZE_DEVICE_ID" // Required if not using changeUser
        )

        try await LinkrunnerSDK.shared.signup(userData: userData)
        ```
      </Tab>

      <Tab title="React Native">
        ```javascript theme={null}
        import linkrunner from "rn-linkrunner";

        await linkrunner.signup({
            user_data: {
                id: "123", // Your user ID
                // ...other user fields
                braze_device_id: "BRAZE_DEVICE_ID", // Required if not using changeUser
            },
            data: {},
        });
        ```
      </Tab>

      <Tab title="Flutter">
        ```dart theme={null}
        import 'package:linkrunner/main.dart';

        await LinkRunner().signup(
          userData: LRUserData(
            id: '123', // Your user ID
            // ...other user fields
            brazeDeviceId: 'BRAZE_DEVICE_ID', // Required if not using changeUser
          ),
          data: {},
        );
        ```
      </Tab>
    </Tabs>

    <Tip>
      You can get the `brazeDeviceId` from the Braze SDK in your app.
    </Tip>
  </Step>

  <Step title="Sync with Braze (Optional)">
    Use the **Sync** feature in the following scenarios:

    * First time after adding your Braze credentials
    * If you see discrepancies in attribution data on Braze profiles

    To sync, click the **Sync with Braze** button in the Linkrunner integration settings. This process may take a while depending on the number of users.
  </Step>
</Steps>

## Viewing Attribution Data

After the integration is complete, you can view the attribution data in Braze:

1. Navigate to a user profile in the Braze dashboard
2. Look for the **Custom Attributes** section
3. You'll see `lr_campaign` and `lr_ad_network` attributes with the corresponding values

This data can be used to:

* Create segments based on acquisition source
* Personalize messaging based on campaign origin
* Analyze user behavior by acquisition channel
