> ## Documentation Index
> Fetch the complete documentation index at: https://radarlabs-andrew-sfmcintegration.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Branch

<Info>
  The Branch integration is available on the [**Enterprise plan**](https://radar.com/pricing).
</Info>

Radar can send events to [Branch](https://branch.io).

Use the Branch integration to attribute offline actions to online campaigns and measure the ROI of location-based features.

## Configuration

On the Branch *Account Settings* page under *Profile*, copy your Branch key.

Then, on the Radar [Integrations page](https://dashboard.radar.com/integrations) under *Branch*, set *Enabled* to *Yes* and paste your key. Note that you can set separate keys for the *Test* and *Live* environments.

Whenever events are generated, Radar will send custom events to Branch.

## User mapping

Radar `deviceId` maps to `idfv` for iOS devices and `android_id` for Android devices in Branch. For web devices, set Radar `metadata.branchFingerprintId` to the Branch Browser Fingerprint Id.

```javascript theme={null}
branch.getBrowserFingerprintId(function(err, data) {
    Radar.setMetadata({ 'branchFingerprintId': data });
});
```

## Event mapping

| Radar Event                         | Context Type                       | Branch Event                   |
| ----------------------------------- | ---------------------------------- | ------------------------------ |
| `user.entered_geofence`             | [Geofences](/geofencing/geofences) | `entered_geofence`             |
| `user.exited_geofence`              | [Geofences](/geofencing/geofences) | `exited_geofence`              |
| `user.dwelled_in_geofence`          | [Geofences](/geofencing/geofences) | `dwelled_in_geofence`          |
| `user.entered_place`                | [Places](/geofencing/places)       | `entered_place`                |
| `user.exited_place`                 | [Places](/geofencing/places)       | `exited_place`                 |
| `user.entered_region_country`       | [Regions](/geofencing/regions)     | `entered_country`              |
| `user.exited_region_country`        | [Regions](/geofencing/regions)     | `exited_country`               |
| `user.entered_region_state`         | [Regions](/geofencing/regions)     | `entered_state`                |
| `user.exited_region_state`          | [Regions](/geofencing/regions)     | `exited_state`                 |
| `user.entered_region_dma`           | [Regions](/geofencing/regions)     | `entered_dma`                  |
| `user.exited_region_dma`            | [Regions](/geofencing/regions)     | `exited_dma`                   |
| `user.started_trip`                 | [Trip Tracking](/geofencing/trips) | `started_trip`                 |
| `user.updated_trip`                 | [Trip Tracking](/geofencing/trips) | `updated_trip`                 |
| `user.approaching_trip_destination` | [Trip Tracking](/geofencing/trips) | `approaching_trip_destination` |
| `user.arrived_at_trip_destination`  | [Trip Tracking](/geofencing/trips) | `arrived_at_trip_destination`  |
| `user.stopped_trip`                 | [Trip Tracking](/geofencing/trips) | `stopped_trip`                 |
| `user.entered_beacon`               | [Beacons](/geofencing/beacons)     | `entered_beacon`               |
| `user.exited_beacon`                | [Beacons](/geofencing/beacons)     | `exited_beacon`                |

### entered\_geofence

| Radar Event Field          | Branch Event Property     | Type    | Example Value                |
| -------------------------- | ------------------------- | ------- | ---------------------------- |
| `geofence._id`             | `geofence_id`             | string  | `"5b2c0906f5874b001aecfd8e"` |
| `geofence.description`     | `geofence_description`    | string  | `"Store #123"`               |
| `geofence.tag`             | `geofence_tag`            | string  | `"store"`                    |
| `geofence.externalId`      | `geofence_external_id`    | string  | `"123"`                      |
| `geofence.metadata[{key}]` | `geofence_metadata_{key}` | type    | `{value}`                    |
| `confidence`               | `confidence`              | string  | `"high"`                     |
| `foreground`               | `foreground`              | boolean | `true`                       |

If [Regions](/geofencing/regions) is enabled, Radar will also send the following attributes:

| Radar Event Field | Branch Event Property | Type   | Example Value     |
| ----------------- | --------------------- | ------ | ----------------- |
| `country.code`    | `country_code`        | string | `"US"`            |
| `country.name`    | `country_name`        | string | `"United States"` |
| `state.code`      | `state_code`          | string | `"MD"`            |
| `state.name`      | `state_name`          | string | `"Maryland"`      |
| `dma.code`        | `dma_code`            | string | `"26"`            |
| `dma.name`        | `dma_name`            | string | `"Baltimore"`     |
| `postalCode.code` | `postal_code`         | string | `"21014"`         |

### exited\_geofence

| Radar Event Field          | Branch Event Property     | Type             | Example Value                |
| -------------------------- | ------------------------- | ---------------- | ---------------------------- |
| `geofence._id`             | `geofence_id`             | string           | `"5b2c0906f5874b001aecfd8e"` |
| `geofence.description`     | `geofence_description`    | string           | `"Store #123"`               |
| `geofence.tag`             | `geofence_tag`            | string           | `"store"`                    |
| `geofence.externalId`      | `geofence_external_id`    | string           | `"123"`                      |
| `geofence.metadata[{key}]` | `geofence_metadata_{key}` | type             | `{value}`                    |
| `confidence`               | `confidence`              | string           | `"high"`                     |
| `duration`                 | `duration`                | number (minutes) | `42.1`                       |
| `foreground`               | `foreground`              | boolean          | `true`                       |

If [Regions](/geofencing/regions) is enabled, Radar will also send the following attributes:

| Radar Event Field | Branch Event Property | Type   | Example Value     |
| ----------------- | --------------------- | ------ | ----------------- |
| `country.code`    | `country_code`        | string | `"US"`            |
| `country.name`    | `country_name`        | string | `"United States"` |
| `state.code`      | `state_code`          | string | `"MD"`            |
| `state.name`      | `state_name`          | string | `"Maryland"`      |
| `dma.code`        | `dma_code`            | string | `"26"`            |
| `dma.name`        | `dma_name`            | string | `"Baltimore"`     |
| `postalCode.code` | `postal_code`         | string | `"21014"`         |

### dwelled\_in\_geofence

| Radar Event Field          | Branch Event Property     | Type             | Example Value                |
| -------------------------- | ------------------------- | ---------------- | ---------------------------- |
| `geofence._id`             | `geofence_id`             | string           | `"5b2c0906f5874b001aecfd8e"` |
| `geofence.description`     | `geofence_description`    | string           | `"Store #123"`               |
| `geofence.tag`             | `geofence_tag`            | string           | `"store"`                    |
| `geofence.externalId`      | `geofence_external_id`    | string           | `"123"`                      |
| `geofence.metadata[{key}]` | `geofence_metadata_{key}` | type             | `{value}`                    |
| `confidence`               | `confidence`              | string           | `"high"`                     |
| `duration`                 | `duration`                | number (minutes) | `5`                          |
| `foreground`               | `foreground`              | boolean          | `true`                       |

If [Regions](/geofencing/regions) is enabled, Radar will also send the following attributes:

| Radar Event Field | Branch Event Property | Type   | Example Value     |
| ----------------- | --------------------- | ------ | ----------------- |
| `country.code`    | `country_code`        | string | `"US"`            |
| `country.name`    | `country_name`        | string | `"United States"` |
| `state.code`      | `state_code`          | string | `"MD"`            |
| `state.name`      | `state_name`          | string | `"Maryland"`      |
| `dma.code`        | `dma_code`            | string | `"26"`            |
| `dma.name`        | `dma_name`            | string | `"Baltimore"`     |
| `postalCode.code` | `postal_code`         | string | `"21014"`         |

### entered\_place

| Radar Event Field             | Branch Event Property        | Type                     | Example Value                      |
| ----------------------------- | ---------------------------- | ------------------------ | ---------------------------------- |
| `place._id`                   | `place_id`                   | string                   | `"59302bcf8f27e8a156bd4f91"`       |
| `place.name`                  | `place_name`                 | string                   | `"Starbucks"`                      |
| `place.chain.slug`            | `place_chain_id`             | string                   | `"starbucks"`                      |
| `place.chain.name`            | `place_chain_name`           | string                   | `"Starbucks"`                      |
| `place.chain.externalId`      | `place_chain_external_id`    | string                   | `"123"`                            |
| `place.chain.metadata[{key}]` | `place_chain_metadata_{key}` | type                     | `{value}`                          |
| `place.categories`            | `place_categories`           | string (comma-separated) | `"food-beverage,cafe,coffee-shop"` |
| `confidence`                  | `confidence`                 | string                   | `"high"`                           |
| `foreground`                  | `foreground`                 | boolean                  | `true`                             |

If [Regions](/geofencing/regions) is enabled, Radar will also send the following attributes:

| Radar Event Field | Branch Event Property | Type   | Example Value     |
| ----------------- | --------------------- | ------ | ----------------- |
| `country.code`    | `country_code`        | string | `"US"`            |
| `country.name`    | `country_name`        | string | `"United States"` |
| `state.code`      | `state_code`          | string | `"MD"`            |
| `state.name`      | `state_name`          | string | `"Maryland"`      |
| `dma.code`        | `dma_code`            | string | `"26"`            |
| `dma.name`        | `dma_name`            | string | `"Baltimore"`     |
| `postalCode.code` | `postal_code`         | string | `"21014"`         |

### exited\_place

| Radar Event Field             | Branch Event Property        | Type                     | Example Value                      |
| ----------------------------- | ---------------------------- | ------------------------ | ---------------------------------- |
| `place._id`                   | `place_id`                   | string                   | `"59302bcf8f27e8a156bd4f91"`       |
| `place.name`                  | `place_name`                 | string                   | `"Starbucks"`                      |
| `place.chain.slug`            | `place_chain_id`             | string                   | `"starbucks"`                      |
| `place.chain.name`            | `place_chain_name`           | string                   | `"Starbucks"`                      |
| `place.chain.externalId`      | `place_chain_external_id`    | string                   | `"123"`                            |
| `place.chain.metadata[{key}]` | `place_chain_metadata_{key}` | type                     | `{value}`                          |
| `place.categories`            | `place_categories`           | string (comma-separated) | `"food-beverage,cafe,coffee-shop"` |
| `confidence`                  | `confidence`                 | string                   | `"high"`                           |
| `duration`                    | `duration`                   | number (minutes)         | `42.1`                             |
| `foreground`                  | `foreground`                 | boolean                  | `true`                             |

If [Regions](/geofencing/regions) is enabled, Radar will also send the following attributes:

| Radar Event Field | Branch Event Property | Type   | Example Value               |
| ----------------- | --------------------- | ------ | --------------------------- |
| `country.code`    | `country_code`        | string | `"US"`                      |
| `country.name`    | `country_name`        | string | `"United States"`(/regions) |
| `state.code`      | `state_code`          | string | `"MD"`                      |
| `state.name`      | `state_name`          | string | `"Maryland"`                |
| `dma.code`        | `dma_code`            | string | `"26"`                      |
| `dma.name`        | `dma_name`            | string | `"Baltimore"`               |
| `postalCode.code` | `postal_code`         | string | `"21014"`                   |

### entered\_country

| Radar Event Attribute | Branch Event Property | Type    | Example Value     |
| --------------------- | --------------------- | ------- | ----------------- |
| `region.code`         | `region_code`         | string  | `"US"`            |
| `region.name`         | `region_name`         | string  | `"United States"` |
| `confidence`          | `confidence`          | string  | `"high"`          |
| `foreground`          | `foreground`          | boolean | `true`            |

### exited\_country

| Radar Event Attribute | Branch Event Property | Type    | Example Value     |
| --------------------- | --------------------- | ------- | ----------------- |
| `region.code`         | `region_code`         | string  | `"US"`            |
| `region.name`         | `region_name`         | string  | `"United States"` |
| `confidence`          | `confidence`          | string  | `"high"`          |
| `foreground`          | `foreground`          | boolean | `true`            |

### entered\_state

| Radar Event Attribute | Branch Event Property | Type    | Example Value |
| --------------------- | --------------------- | ------- | ------------- |
| `region.code`         | `region_code`         | string  | `"MD"`        |
| `region.name`         | `region_name`         | string  | `"Maryland"`  |
| `confidence`          | `confidence`          | string  | `"high"`      |
| `foreground`          | `foreground`          | boolean | `true`        |

### exited\_state

| Radar Event Attribute | Branch Event Property | Type    | Example Value |
| --------------------- | --------------------- | ------- | ------------- |
| `region.code`         | `region_code`         | string  | `"MD"`        |
| `region.name`         | `region_name`         | string  | `"Maryland"`  |
| `confidence`          | `confidence`          | string  | `"high"`      |
| `foreground`          | `foreground`          | boolean | `true`        |

### entered\_dma

| Radar Event Attribute | Branch Event Property | Type    | Example Value |
| --------------------- | --------------------- | ------- | ------------- |
| `region.code`         | `region_code`         | string  | `"26"`        |
| `region.name`         | `region_name`         | string  | `"Baltimore"` |
| `confidence`          | `confidence`          | string  | `"high"`      |
| `foreground`          | `foreground`          | boolean | `true`        |

### exited\_dma

| Radar Event Attribute | Branch Event Property | Type    | Example Value |
| --------------------- | --------------------- | ------- | ------------- |
| `region.code`         | `region_code`         | string  | `"26"`        |
| `region.name`         | `region_name`         | string  | `"Baltimore"` |
| `confidence`          | `confidence`          | string  | `"high"`      |
| `foreground`          | `foreground`          | boolean | `true`        |

### started\_trip

| Radar Event Attribute                | Branch Event Property                   | Type    | Example Value |
| ------------------------------------ | --------------------------------------- | ------- | ------------- |
| `trip.externalId`                    | `trip_external_id`                      | string  | `"299"`       |
| `trip.metadata[{key}]`               | `trip_metadata_{key}`                   | type    | `{value}`     |
| `trip.destinationGeofenceTag`        | `trip_destination_geofence_tag`         | string  | `"store"`     |
| `trip.destinationGeofenceExternalId` | `trip_destination_geofence_external_id` | string  | `"123"`       |
| `foreground`                         | `foreground`                            | boolean | `true`        |

### updated\_trip

| Radar Event Attribute                | Branch Event Property                   | Type    | Example Value |
| ------------------------------------ | --------------------------------------- | ------- | ------------- |
| `trip.externalId`                    | `trip_external_id`                      | string  | `"299"`       |
| `trip.metadata[{key}]`               | `trip_metadata_{key}`                   | type    | `{value}`     |
| `trip.destinationGeofenceTag`        | `trip_destination_geofence_tag`         | string  | `"store"`     |
| `trip.destinationGeofenceExternalId` | `trip_destination_geofence_external_id` | string  | `"123"`       |
| `foreground`                         | `foreground`                            | boolean | `true`        |

### approaching\_trip\_destination

| Radar Event Attribute                | Branch Event Property                   | Type    | Example Value |
| ------------------------------------ | --------------------------------------- | ------- | ------------- |
| `trip.externalId`                    | `trip_external_id`                      | string  | `"299"`       |
| `trip.metadata[{key}]`               | `trip_metadata_{key}`                   | type    | `{value}`     |
| `trip.destinationGeofenceTag`        | `trip_destination_geofence_tag`         | string  | `"store"`     |
| `trip.destinationGeofenceExternalId` | `trip_destination_geofence_external_id` | string  | `"123"`       |
| `foreground`                         | `foreground`                            | boolean | `true`        |

### arrived\_at\_trip\_destination

| Radar Event Attribute                | Branch Event Property                   | Type    | Example Value |
| ------------------------------------ | --------------------------------------- | ------- | ------------- |
| `trip.externalId`                    | `trip_external_id`                      | string  | `"299"`       |
| `trip.metadata[{key}]`               | `trip_metadata_{key}`                   | type    | `{value}`     |
| `trip.destinationGeofenceTag`        | `trip_destination_geofence_tag`         | string  | `"store"`     |
| `trip.destinationGeofenceExternalId` | `trip_destination_geofence_external_id` | string  | `"123"`       |
| `foreground`                         | `foreground`                            | boolean | `true`        |

### stopped\_trip

| Radar Event Attribute                | Branch Event Property                   | Type    | Example Value |
| ------------------------------------ | --------------------------------------- | ------- | ------------- |
| `trip.externalId`                    | `trip_external_id`                      | string  | `"299"`       |
| `trip.metadata[{key}]`               | `trip_metadata_{key}`                   | type    | `{value}`     |
| `trip.destinationGeofenceTag`        | `trip_destination_geofence_tag`         | string  | `"store"`     |
| `trip.destinationGeofenceExternalId` | `trip_destination_geofence_external_id` | string  | `"123"`       |
| `foreground`                         | `foreground`                            | boolean | `true`        |

### entered\_beacon

| Radar Event Attribute    | Branch Event Property   | Type    | Example Value                |
| ------------------------ | ----------------------- | ------- | ---------------------------- |
| `beacon._id`             | `beacon_id`             | string  | `"5b2c0906f5874b001aecfd8f"` |
| `beacon.description`     | `beacon_description`    | string  | `"Store #123 - Drive-Thru"`  |
| `beacon.tag`             | `beacon_tag`            | string  | `"drive-thru"`               |
| `beacon.externalId`      | `beacon_external_id`    | string  | `"123"`                      |
| `beacon.metadata[{key}]` | `beacon_metadata_{key}` | type    | `{value}`                    |
| `confidence`             | `confidence`            | string  | `"high"`                     |
| `foreground`             | `foreground`            | boolean | `true`                       |

### exited\_beacon

| Radar Event Attribute    | Branch Event Property   | Type             | Example Value                |
| ------------------------ | ----------------------- | ---------------- | ---------------------------- |
| `beacon._id`             | `beacon_id`             | string           | `"5b2c0906f5874b001aecfd8f"` |
| `beacon.description`     | `beacon_description`    | string           | `"Store #123 - Drive-Thru"`  |
| `beacon.tag`             | `beacon_tag`            | string           | `"drive-thru"`               |
| `beacon.externalId`      | `beacon_external_id`    | string           | `"123"`                      |
| `beacon.metadata[{key}]` | `beacon_metadata_{key}` | type             | `{value}`                    |
| `confidence`             | `confidence`            | string           | `"high"`                     |
| `duration`               | `duration`              | number (minutes) | `1.42`                       |
| `foreground`             | `foreground`            | boolean          | `true`                       |
