Track a goal from your server
Records a custom goal (for example signup after your backend confirms an account). Pass the visitor id from the browser to credit the visit that led to it; it then joins that visit and its traffic source. ts may be up to 30 days in the past.
Related: Goals report and Goals over time in Goals.
Request
Path parameters
websitestringrequiredWebsite id or domain, e.g. example.com
1–253 characters
Headers
AuthorizationstringrequiredBearer followed by a site key, an account token or an OAuth access token with the goals:write scope.
Content-TypestringrequiredSend the body as JSON.
One of: application/json
Body fields
namestringrequiredPattern: ^[a-z0-9][a-z0-9_:-]{0,63}$
visitorIdstringoptional8–64 characters
sessionIdstringoptional8–64 characters
propsobject<string, string>optionalKeys up to 64 characters · Values up to 512 characters
tsstring (date-time)optionalResponse
Accepted for processing.
{
"status": "string",
"data": {
"accepted": true,
"outcome": "string",
"visitorId": "string",
"sessionId": "string"
}
}Response fields
| Field | Type | Description |
|---|---|---|
| status | "ok" | |
| data | object | |
| data.accepted | boolean | |
| data.outcome | string | |
| data.visitorId | string | |
| data.sessionId | string |