API
Segments endpoints
These endpoints manage saved segments. Reading needs segments:read, and writing needs segments:write. To apply a segment, send its ID as segment_id on any analytics endpoint.
Last updated .
GET /sites/:siteId/segments
Returns the segments for the site and the organization, sorted by name. Public sites and private links get only public segments.
[ { "segmentId": 4, "siteId": null, "name": "Norwegian mobile", "filters": [ { "parameter": "country", "type": "equals", "value": ["NO"] }, { "parameter": "device_type", "type": "equals", "value": ["Mobile"] } ], "isPublic": false, "canEdit": true } ]
siteId is null for a segment that covers the whole organization.
How do you create or change a segment?
| Request | Result |
|---|---|
POST /sites/:siteId/segments | Creates one. Status 201 with the segment |
PUT /sites/:siteId/segments/:id | Changes the fields you send |
DELETE /sites/:siteId/segments/:id | Deletes it |
| Field | Required | Limits |
|---|---|---|
name | Yes | 1 to 80 characters |
filters | Yes | 1 to 20 filters, each with up to 50 values |
description | No | Up to 500 characters |
isPublic | No | true shows it on shared dashboards |
scope | No | site or organization. organization needs an admin |
The body is checked strictly. A field that is not in the table returns status 400.