## Example JSON Payloads

Visits HistoricalVisits DepartureVisits ArrivalGeofence ExitGeofence EnterGeofence Dwell

```json
{
    "userId": "{String}",
    "context": {
        "traits": {},
        "localeactions": "en",
        "device": {
            "advertisingId": "{String}"
        }
    },
    "event": "placeHistorical",
    "properties": {
        "visitType": "historical",
        "probability": "{Double}",
        "confidence": "{String}",
        "lat": "{Double}",
        "lng": "{Double}",
        "locationType": "{String}",
        "visitId": "{String}",
        "timestamp": "{YYYY-MM-DDTHH:MM:SS.XXXZ}",
        "venueName": "{String}",
        "venueId": "{String}",
        "primaryCategoryName": "{String}",
        "primaryCategoryId": "{String}",
        "primaryChainName": "{String}",
        "primaryChainID": "{String}",
        "address": "{String}",
        "crossStreet": "{String}",
        "city": "{String}",
        "state": "{String}",
        "zipCode": "{String}",
        "country": "{String}",
        "supervenueId": "{String}",
        "supervenueName": "{String}",
        "supervenuePrimaryCategoryId": "{String}",
        "supervenuePrimaryCategoryName": "{String}",
        "supervenuePrimaryChainId": "{String}",
        "supervenuePrimaryChainName": "{String}"
    },
    "type": "track"
}
```

```json
{
    "EventDefinitionKey": "pilgrimArrivalEntrySource",
    "ContactKey": "{String}",
    "Data": {
        "visitType": "departure",
        "confidence": "{ConfidenceLevel}",
        "lat": "{lat}",
        "lng": "{long}",
        "locationType": "venue",
        "visitId": "{VisitID}",
        "timestamp": "{Timestamp}",
        "venueName": "{VenueName}",
        "venueId": "{VenueID}",
        "primaryCategoryName": "{PrimaryCategoryName}",
        "primaryCategoryId": "{PrimaryCategoryID}",
        "address": "{Address}",
        "crossStreet": "{Cross Street}",
        "city": "{CityName}",
        "state": "{StateCode}",
        "zipCode": "{ZipCode}",
        "country": "{CountryCode}",
        "ContactKey": "{String}",
        "userId": "{String}"
    }
}
```

```json
{
    "EventDefinitionKey": "pilgrimArrivalEntrySource",
    "ContactKey": "{String}",
    "Data": {
        "visitType": "arrival",
        "confidence": "{ConfidenceLevel}",
        "lat": "{lat}",
        "lng": "{long}",
        "locationType": "venue",
        "visitId": "{VisitID}",
        "timestamp": "{Timestamp}",
        "venueName": "{VenueName}",
        "venueId": "{VenueID}",
        "primaryCategoryName": "{PrimaryCategoryName}",
        "primaryCategoryId": "{PrimaryCategoryID}",
        "address": "{Address}",
        "crossStreet": "{Cross Street}",
        "city": "{CityName}",
        "state": "{StateCode}",
        "zipCode": "{ZipCode}",
        "country": "{CountryCode}",
        "ContactKey": "{String}",
        "userId": "{String}"
    }
}
```

```json
{
    "EventDefinitionKey": "pilgrimArrivalEntrySource",
    "ContactKey": "{String}",
    "Data": {
        "geofenceEventType": "exit",
        "geofenceLat": "{Double}",
        "geofenceLng": "{Double}",
        "radius": "{Double}",
        "venueId": "{String}",
        "categoryIds": "{String}",
        "venueChainIds": "{String}",
        "partnerVenueId": "{String}",
        "eventLat": "{Double}",
        "eventLng": "{Double}",
        "geofenceId": "{String}",
        "geofenceName": "{String}",
        "geofenceProperties": {},
        "ContactKey": "{String}",
        "userId": "{String}"
    }
}
```

```json
{
    "userId": "{String}",
    "eventName": "geofenceEnter",
    "createdAt": 1646691428,
    "dataFields": {
        "geofenceEventType": "entrance",
        "geofenceLat": "{Double}",
        "geofenceLng": "{Double}",
        "radius": "{Double}",
        "venueId": "{String}",
        "categoryIds": "{String}",
        "venueChainIds": "{String}",
        "partnerVenueId": "{String}",
        "eventLat": "{Double}",
        "eventLng": "{Double}",
        "geofenceId": "{String}",
        "geofenceName": "{String}"
    }
}
```

```json
{
    "userId": "{String}",
    "eventName": "geofenceDwell",
    "createdAt": 1646691515,
    "dataFields": {
        "geofenceEventType": "dwell",
        "geofenceLat": "{Double}",
        "geofenceLng": "{Double}",
        "radius": "{Double}",
        "venueId": "{String}",
        "categoryIds": "{String}",
        "venueChainIds": "{String}",
        "partnerVenueId": "{String}",
        "eventLat": "{Double}",
        "eventLng": "{Double}",
        "geofenceId": "{String}",
        "geofenceName": "{String}"
    }
}
```

## Integration Details

> 📘
> 
> ### Visits & Geofence Data Schemas
> 
> To view the schemas for the visits and geofence events data you will be receiving, please see:
> 
> - [Geofence Data Schema](https://docs.foursquare.com/developer/docs/geofence-data-schema)
> - [Visits Data Schema](https://docs.foursquare.com/developer/docs/visits-data-schema-pilgrim)
> 
> 1. Make sure both [OneSignal](https://documentation.onesignal.com/docs) and the [Pilgrim SDK](https://docs.foursquare.com/developer/docs/pilgrim-sdk) are properly setup.
> 2. In order to properly map your OneSignal users to Foursquare, you will need to:
>    - Associate your own User Ids to each of their corresponding OneSignal device records via the [external_user_id](https://documentation.onesignal.com/docs/external-user-ids).
>    - Set the associated OneSignal `external_user_id`s by using the `setUserId method` of `PilgrimUserInfo` in the Pilgrim SDK.
> 3. Enter your [OneSignal App ID](https://documentation.onesignal.com/docs/accounts-and-keys#app-id) in to your app's [Foursquare Pilgrim Console](https://foursquare.com/developers/apps/).
> 4. Once you have configured the Pilgrim Console, the Pilgrim SDK will automatically track location events and forward them to OneSignal, allowing you to retarget and segment your customers.
