API
Goals endpoints
These endpoints read and manage goals. Reading needs goals:read, and changing needs goals:write. Public sites and private links can read the list.
Last updated . This guide belongs to Custom events and goals.
GET /sites/:siteId/goals
| Parameter | Meaning | Default |
|---|---|---|
page, page_size | Paging. Maximum 100 | 1, 10 |
sort | goalId, name, goalType or createdAt | createdAt |
order | asc or desc | desc |
The shared time parameters, filters and segment_id change the conversion numbers, not the list of goals.
{ "data": [ { "goalId": 12, "name": "Signup", "goalType": "event", "config": { "eventName": "signup_completed" }, "total_conversions": 184, "total_sessions": 5120, "conversion_rate": 0.0359 } ], "meta": { "total": 4, "page": 1, "pageSize": 10, "totalPages": 1 } }
conversion_rate is a fraction from 0 to 1.
How do you create or change a goal?
| Request | Result |
|---|---|
POST /sites/:siteId/goals | Creates a goal. Status 201 with goalId |
PUT /sites/:siteId/goals/:goalId | Replaces the whole goal |
DELETE /sites/:siteId/goals/:goalId | Deletes it |
| Field | Required | Content |
|---|---|---|
goalType | Yes | path, event, outbound, button_click, form_submit or copy |
name | No | A label |
config.pathPattern | For path | A path. * matches one segment and ** matches anything |
config.eventName | For event | The exact event name |
config.valuePattern | No | For the captured types. Up to 512 characters |
config.propertyFilters | No | A list of { key, value }. All must match |
Which other goal endpoints are there?
| Endpoint | Returns |
|---|---|
GET /sites/:siteId/goals/time-series | Conversions per bucket. Send goal_ids as a comma-separated list |
GET /sites/:siteId/goals/:goalId/sessions | The sessions that reached the goal. Not available for public sites |