Source: https://datafa.st/docs/api/website/analytics/realtime-map
Markdown source: https://datafa.st/docs/api/website/analytics/realtime-map.md
Description: Return active visitors, recent events, recent payments, and prediction data for realtime map views.

# Get realtime map

`GET https://datafa.st/api/v1/analytics/realtime/map`

Return active visitors, recent events, recent payments, and prediction data for realtime map views.

## Request

### Authentication

- `df_` website API key for one website.
- `dft_` account token with `analytics:read`. Pass `websiteId` as a query parameter.



## Response

Returns a JSON object with `status` and endpoint-specific fields.

### Response fields

| Field | Type | Description |
| --- | --- | --- |
| `data.count` | number | Number of currently active visitors in the realtime window. |
| `data.visitors` | object[] | Number of unique visitors represented by this row or time bucket. Use it to compare traffic volume across dates, pages, sources, countries, devices, or campaigns. Active visitor records used to draw the realtime map/list. |
| `data.visitors[].visitorId` | string | Alias for `datafast_visitor_id` on endpoints that accept both names. |
| `data.visitors[].location` | object | Location used to place the visitor on the map. |
| `data.visitors[].location.city` | string|null | Visitor city. |
| `data.visitors[].location.region` | string|null | Visitor region or state. |
| `data.visitors[].location.countryCode` | string|null | Two-letter country code. |
| `data.visitors[].system` | object | Browser, OS, and device values for the active visitor. |
| `data.visitors[].system.browser` | string|null | Browser name. |
| `data.visitors[].system.os` | string|null | Operating system name. |
| `data.visitors[].system.device` | string|null | Device type. |
| `data.visitors[].currentUrl` | string|null | Latest page URL seen for the visitor. Use it to understand where the visitor was last active before you inspect the full visitor profile. |
| `data.visitors[].profileData` | object | Identify profile display data. |
| `data.visitors[].conversionLikelihood` | object|null | Prediction score and raw values when available. |
| `data.conversionMetrics` | object | Baseline conversion metrics used for predictions. |
| `data.hasConversionPredictions` | boolean | Whether prediction fields are available. |
| `data.recentEvents` | object[] | Recent goal/custom events shown in realtime UI. |
| `data.recentPayments` | object[] | Recent payment events shown in realtime UI. |

### Errors

Common errors include `400` for invalid input, `401` for missing or invalid tokens, `403` for missing permission or suspended tracking, `404` for missing resources, and `500` for server errors.

## Code examples

### Example request

```bash
curl -X GET "https://datafa.st/api/v1/analytics/realtime/map" \
  -H "Authorization: Bearer df_xxx"
```

### Success response

```json
{
  "status": "success",
  "data": {
    "count": 2,
    "visitors": [{
      "visitorId": "a3ab2331-989f-4cfa-91c6-2461c9e3c6bd",
      "location": {
        "city": "Paris",
        "countryCode": "FR"
      },
      "system": {
        "browser": "Chrome",
        "device": "desktop"
      },
      "currentUrl": "/pricing"
    }],
    "hasConversionPredictions": false,
    "recentEvents": [],
    "recentPayments": []
  }
}
```
