# Foursquare Movement Source

## Source Info

* The Foursquare Movement Source is an **Event Cloud** source. This means that it sends data as events, which are behaviors or occurrences tied to a user and a point in time. Data from these sources can be loaded into your Segment warehouses, and **also** sent to Segment streaming destinations. [Learn more about cloud sources.](/docs/segment/connections/sources#cloud-app-sources)
* This integration is **partner owned** . Please reach out to the partner's support for any issues.

> \[!WARNING]
>
> This Source is only supported in workspaces configured to process data in the US region. Workspaces configured with data processing regions outside of the US cannot connect to this source. For more information, see [Regional Segment](/docs/segment/guides/regional-segment/).

[Foursquare's Movement SDK](https://location.foursquare.com/products/movement-sdk/) provides real-time event triggering based upon your users' location in the physical world, allowing you to harness FourSquare's powerful geotargeting capabilities to send those events to other services using Segment.

This destination is maintained by Foursquare. For any issues with the destination, contact the [Foursquare Developer support team](mailto:developers@foursquare.com).

> \[!IMPORTANT]
>
> This means the feature is actively being developed, and some functionality may change before it becomes generally available.

## Getting started

1. From the Segment web app, click **Catalog**.
2. Search for "Foursquare Movement" in the catalog, select it, and choose which of your sources to connect the it to.
3. Once you save Foursquare Movement as a source, copy your "Write Key".
4. Go to your [Foursquare Developer Console](https://foursquare.com/developers/apps/) and create a new Segment integration in your Foursquare app's Movement SDK console. There you can enter the Segment "Write Key" into the Segment Integration Configuration screen.

## Events

The following table lists events that Foursquare's Movement SDK sends to Segment. These events will show up as tables in your warehouse, and as regular events in your other destinations. Foursquare will send through the `userId` if available.

| Event name             | Description                                                                                                                                                                       |
| ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| placeArrival           | Device has arrived at a venue. Usually occurs after 3-7 minutes.                                                                                                                  |
| placeDeparture         | Device has left a visited venue.                                                                                                                                                  |
| placeHistorical        | Device previously arrived or departed a venue, but the device didn't have network connectivity at the time, but Foursquare lets you know as soon as they have connectivity again. |
| geofenceEnter          | Device has entered a venue, polygon or lat/lng geofence.                                                                                                                          |
| geofenceDwell          | Device has remained within geofence for pre-determined time.                                                                                                                      |
| geofenceVenueConfirmed | Device has dwelled within geofence AND Foursquare thinks this is actually the venue the device is at.                                                                             |
| geofenceExit           | Device has left geofence.                                                                                                                                                         |

### Event properties

The following tables outline the properties included in the events.

#### Place visit event properties

All fields are presented as strings.

| Property name       | Description                                                                                 | Values                         |
| ------------------- | ------------------------------------------------------------------------------------------- | ------------------------------ |
| address             | Address of visit venue                                                                      | String                         |
| city                | City of visit venue                                                                         | String                         |
| confidence          | How likely Foursquare thinks it's correct                                                   | low, medium, high              |
| country             | Country of visit venue                                                                      | String                         |
| crossStreet         | Cross street of visit venue                                                                 | String                         |
| lat                 | Latitude of event                                                                           | Double                         |
| lng                 | Longitude of event                                                                          | Double                         |
| locationType        | Indicates if Foursquare thinks this location is device's home or work, otherwise uses venue | work, home, venue              |
| primaryCategoryId   | Foursquare Category ID of visit venue                                                       | String                         |
| primaryCategoryName | Human readable category name of visit venue                                                 | String                         |
| state               | Abbreviation of state or province of visit venue                                            | String                         |
| timestamp           | ISO 8601 timestamp of when event happened                                                   | Timestamp                      |
| venueId             | Foursquare ID of visit venue                                                                | String                         |
| venueName           | Name of visit venue                                                                         | String                         |
| visitType           | Visit type                                                                                  | arrival, departure, historical |
| zipCode             | Zip or postal code for visit venue                                                          | String                         |

Example:

```js
"address": "225 W Ohio St",
"city": "Chicago",
"confidence": "high",
"country": "US",
"crossStreet": "",
"lat": "41.892114",
"lng": "-87.635638",
"locationType": "work",
"primaryCategoryId": "4bf58dd8d48988d130941735",
"primaryCategoryName": "Building",
"probability": "0.5112834298670852",
"state": "IL",
"timestamp": "2020-01-22T15:04:55.000Z",
"venueId": "4d21e2ffdd6a236a9c514338",
"venueName": "225 West Ohio",
"visitId": "5e286497d6d764000801604d",
"visitType": "arrival",
"zipCode": "60654"
```

#### Geofence event properties

| Property name      | Description                                       | Values                                                    |
| ------------------ | ------------------------------------------------- | --------------------------------------------------------- |
| categoryIds        | Comma separated string of Foursquare category IDs | String                                                    |
| geofenceEventType  | Geofence event type                               | `venueEnter`, `venueDwell`, `venueConfirmed`, `venueExit` |
| geofenceId         | Foursquare Geofence ID                            | String                                                    |
| geofenceLat        | Latitude of triggered geofence center             | Double                                                    |
| geofenceLng        | Longitude of triggered geofence center            | Double                                                    |
| geofenceName       | Name of triggered geofence                        | String                                                    |
| geofenceProperties | Custom properties of triggered geofence           | Key/value Pair                                            |
| radius             | Minimum 50m, radius of triggered geofence         | Int                                                       |
| venueChainIds      | Comma separated string of Foursquare chain IDs    | String                                                    |
| venueId            | Foursquare ID of geofenced venue                  | String                                                    |

Example:

```js
"categoryIds": "",
"geofenceEventType": "venueEnter",
"geofenceId": "5dae122e0444bf0008d7f550",
"geofenceLat": "41.89213",
"geofenceLng": "-87.63534",
"geofenceName": "Foursquare Chicago",
"geofenceProperties": {},
"radius": "100.0",
"venueChainIds": "",
"venueId": "52af211911d2aa9d4a1f0e0a"
```

## Adding destinations

Now that your source is set up, you can connect it to destinations.

Log in to your downstream tools and check that your events appear and contain all the expected properties. If events and properties do not appear, refer to the relevant destination docs for troubleshooting.

If you experience any issues with how the events arrive in Segment, [contact the Foursquare team](mailto:developers@foursquare.com).
