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

# Mixpanel

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

Radar can send events and user properties to [Mixpanel](https://www.mixpanel.com).

Use the Mixpanel integration to enrich behavioral events with location context, measure the ROI of location-based features, and build location-based user segments.

## Configuration

On the Mixpanel *Project Settings* page, copy the token from the Access Keys section. Then, on the Radar [Integrations page](https://dashboard.radar.com/integrations) under *Mixpanel*, set *Enabled* to *Yes* and paste your token. Note that you can set separate tokens for the *Test* and *Live* environments.

Whenever events are generated, Radar will send custom events and user properties to Mixpanel.

By default, Radar `userId` maps to Mixpanel `distinct ID` for logged in users. However, you can specify a custom mapping by setting Radar `metadata.mixpanelDistinctId`. For example, on iOS:

```swift theme={null}
Radar.setMetadata(["mixpanelDistinctId": distinctIdValue])
```

## User mapping

Note that Radar uses the special string `"(null)"` to represent `null` user property values.

| Radar User Field | Mixpanel User Property | Type | Example Value | Context Type |
| - | - | - | - | - |
| `location.coordinates[1]` | `$latitude` | number | `39.525665` | |
| `location.coordinates[0]` | `$longitude` | number | `-76.350663` | |
| `metadata.mixpanelDistinctId` or `userId` | `Distinct ID` | string | `"1"` | |
| `location.coordinates[0]` | `Radar Location Longitude` | number | `-76.350663` | |
| `location.coordinates[1]` | `Radar Location Latitude` | number | `39.525665` | |
| `locationAuthorization` | `Radar Location Authorization` | string | `"GRANTED_FOREGROUND"` | |
| `locationAccuracyAuthorization` | `Radar Location Accuracy Authorization` | string | `"FULL"` | |
| `_id` | `Radar ID` | string | `"5b2c0906f5874b001aecfd8d"` | |
| `updatedAt` | `Radar Updated At` | timestamp | `"2018-06-22T15:23:39.000Z"` | |
| `segments[*].externalId` | `Radar Segment External IDs` | array\[string] | `["starbucks-visitors"]` | |
| `topChains[*].slug` | `Radar Top Chain Slugs` | array\[string] | `["starbucks", "walmart"]` | |
| `topChains[*].externalId` | `Radar Top Chain External IDs` | array\[string] | `["123", "456"]` | |
| `geofences[*]._id` | `Radar Geofence IDs` | array\[string] | `["5b2c0906f5874b001aecfd8e"]` | [Geofences](/geofencing/geofences) |
| `geofences[*].description` | `Radar Geofence Descriptions` | array\[string] | `["Store #123"]` | [Geofences](/geofencing/geofences) |
| `geofences[*].tag` | `Radar Geofence Tags` | array\[string] | `["store"]` | [Geofences](/geofencing/geofences) |
| `geofences[*].externalId` | `Radar Geofence External IDs` | array\[string] | `["123"]` | [Geofences](/geofencing/geofences) |
| `place._id` | `Radar Place ID` | string | `"59302bcf8f27e8a156bd4f91"` | [Places](/geofencing/places) |
| `place.name` | `Radar Place Name` | string | `"Starbucks"` | [Places](/geofencing/places) |
| `place.categories` | `Radar Place Categories` | array\[string] | `["food-beverage", "cafe", "coffee-shop"]` | [Places](/geofencing/places) |
| `place.chain.slug` | `Radar Place Chain Slug` | string | `"starbucks"` | [Places](/geofencing/places) |
| `place.chain.name` | `Radar Place Chain Name` | string | `"Starbucks"` | [Places](/geofencing/places) |
| `country.code` | `Radar Region Country Code` | string | `"US"` | [Regions](/geofencing/regions) |
| `country.name` | `Radar Region Country Name` | string | `"United States"` | [Regions](/geofencing/regions) |
| `state.code` | `Radar Region State Code` | string | `"MD"` | [Regions](/geofencing/regions) |
| `state.name` | `Radar Region State Name` | string | `"Maryland"` | [Regions](/geofencing/regions) |
| `dma.code` | `Radar Region DMA Code` | string | `"26"` | [Regions](/geofencing/regions) |
| `dma.name` | `Radar Region DMA Name` | string | `"Baltimore"` | [Regions](/geofencing/regions) |
| `postalCode.code` | `Radar Region Postal Code` | string | `"21014"` | [Regions](/geofencing/regions) |
| `trip.externalId` | `Radar Trip External ID` | string | `"299"` | [Trip Tracking](/geofencing/trips) |
| `trip.destinationGeofenceTag` | `Radar Trip Destination Geofence Tag` | string | `"store"` | [Trip Tracking](/geofencing/trips) |
| `trip.destinationGeofenceExternalId` | `Radar Trip Destination Geofence External ID` | string | `"123"` | [Trip Tracking](/geofencing/trips) |
| `beacons[*]._id` | `Radar Beacon IDs` | array\[string] | `["5b2c0906f5874b001aecfd8f"]` | [Beacons](/geofencing/beacons) |
| `beacons[*].description` | `Radar Beacon Descriptions` | array\[string] | `["Store #123 - Drive-Thru"]` | [Beacons](/geofencing/beacons) |
| `beacons[*].tag` | `Radar Beacon Tags` | array\[string] | `["drive-thru"]` | [Beacons](/geofencing/beacons) |
| `beacons[*].externalId` | `Radar Beacon External IDs` | array\[string] | `["123"]` | [Beacons](/geofencing/beacons) |

## Event mapping

| Radar Event | Context Type | Mixpanel Event |
| - | - | - |
| `user.entered_geofence` | [Geofences](/geofencing/geofences) | `Radar Geofence Entered` |
| `user.exited_geofence` | [Geofences](/geofencing/geofences) | `Radar Geofence Exited` |
| `user.dwelled_in_geofence` | [Geofences](/geofencing/geofences) | `Radar Dwelled in Geofence` |
| `user.entered_place` | [Places](/geofencing/places) | `Radar Place Entered` |
| `user.exited_place` | [Places](/geofencing/places) | `Radar Place Exited` |
| `user.entered_region_country` | [Regions](/geofencing/regions) | `Radar Country Entered` |
| `user.exited_region_country` | [Regions](/geofencing/regions) | `Radar Country Exited` |
| `user.entered_region_state` | [Regions](/geofencing/regions) | `Radar State Entered` |
| `user.exited_region_state` | [Regions](/geofencing/regions) | `Radar State Exited` |
| `user.entered_region_dma` | [Regions](/geofencing/regions) | `Radar DMA Entered` |
| `user.exited_region_dma` | [Regions](/geofencing/regions) | `Radar DMA Exited` |
| `user.started_trip` | [Trip Tracking](/geofencing/trips) | `Radar Started Trip` |
| `user.updated_trip` | [Trip Tracking](/geofencing/trips) | `Radar Updated Trip` |
| `user.approaching_trip_destination` | [Trip Tracking](/geofencing/trips) | `Radar Approaching Trip Destination` |
| `user.arrived_at_trip_destination` | [Trip Tracking](/geofencing/trips) | `Radar Arrived at Trip Destination` |
| `user.stopped_trip` | [Trip Tracking](/geofencing/trips) | `Radar Stopped Trip` |
| `user.entered_beacon` | [Beacons](/geofencing/beacons) | `Radar Beacon Entered` |
| `user.exited_beacon` | [Beacons](/geofencing/beacons) | `Radar Beacon Exited` |

### Radar Geofence Entered

| Radar Event Field | Mixpanel Event Property | Type | Example |
| - | - | - | - |
| `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` | string | `true` |

### Radar Geofence Exited

| Radar Event Field | Mixpanel Event Property | Type | Example |
| - | - | - | - |
| `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` | string | `true` |

### Radar Dwelled in Geofence

| Radar Event Field | Mixpanel Event Property | Type | Example |
| - | - | - | - |
| `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` | string | `true` |

### Radar Place Entered

| Radar Event Field | Mixpanel Event Property | Type | Example |
| - | - | - | - |
| `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.categories` | `Place Categories` | array\[string] | `["food-beverage", "cafe", "coffee-shop"]` |
| `confidence` | `Confidence` | string | `"high"` |
| `foreground` | `Foreground` | string | `true` |

### Radar Place Exited

| Radar Event Field | Mixpanel Event Property | Type | Example |
| - | - | - | - |
| `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.categories` | `Place Categories` | array\[string] | `["food-beverage", "cafe", "coffee-shop"]` |
| `confidence` | `Confidence` | string | `"high"` |
| `duration` | `Duration` | number (minutes) | `42.1` |
| `foreground` | `Foreground` | string | `true` |

### Radar Country Entered

| Radar Event Field | Mixpanel Event Property | Type | Example Value |
| - | - | - | - |
| `region.code` | `Region Code` | string | `"US"` |
| `region.name` | `Region Name` | string | `"United States"` |
| `confidence` | `Confidence` | string | `"high"` |
| `foreground` | `Foreground` | string | `true` |

### Radar Country Exited

| Radar Event Field | Mixpanel Event Property | Type | Example Value |
| - | - | - | - |
| `region.code` | `Region Code` | string | `"US"` |
| `region.name` | `Region Name` | string | `"United States"` |
| `confidence` | `Confidence` | string | `"high"` |
| `foreground` | `Foreground` | string | `true` |

### Radar State Entered

| Radar Event Field | Mixpanel Event Property | Type | Example Value |
| - | - | - | - |
| `region.code` | `Region Code` | string | `"MD"` |
| `region.name` | `Region Name` | string | `"Maryland"` |
| `confidence` | `Confidence` | string | `"high"` |
| `foreground` | `Foreground` | string | `true` |

### Radar State Exited

| Radar Event Field | Mixpanel Event Property | Type | Example Value |
| - | - | - | - |
| `region.code` | `Region Code` | string | `"MD"` |
| `region.name` | `Region Name` | string | `"Maryland"` |
| `confidence` | `Confidence` | string | `"high"` |
| `foreground` | `Foreground` | string | `true` |

### Radar DMA Entered

| Radar Event Field | Mixpanel Event Property | Type | Example Value |
| - | - | - | - |
| `region.code` | `Region Code` | string | `"26"` |
| `region.name` | `Region Name` | string | `"Baltimore"` |
| `confidence` | `Confidence` | string | `"high"` |
| `foreground` | `Foreground` | string | `true` |

### Radar DMA Exited

| Radar Event Field | Mixpanel Event Property | Type | Example Value |
| - | - | - | - |
| `region.code` | `Region Code` | string | `"26"` |
| `region.name` | `Region Name` | string | `"Baltimore"` |
| `confidence` | `Confidence` | string | `"high"` |
| `foreground` | `Foreground` | string | `true` |

### Radar Started Trip

| Radar Event Attribute | Mixpanel 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` | string | `true` |

### Radar Updated Trip

| Radar Event Attribute | Mixpanel 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` | string | `true` |

### Radar Approaching Trip Destination

| Radar Event Attribute | Mixpanel 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` | string | `true` |

### Radar Arrived at Trip Destination

| Radar Event Attribute | Mixpanel 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` | string | `true` |

### Radar Stopped Trip

| Radar Event Attribute | Mixpanel 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` | string | `true` |

### Radar Beacon Entered

| Radar Event Attribute | Mixpanel 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` | string | `true` |

### Radar Beacon Exited

| Radar Event Attribute | Mixpanel 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` | string | `true` |
