API reference

Goals API

Record a goal for a visitor from your server with POST /api/v1/goals: the request body, examples in curl, Node.js and Python, and the responses.

POST https://supranalytics.app/api/v1/goals

Records a goal for a visitor, attached to their latest visit. It shows up on the dashboard and in the live view, and sends goal alerts.

Body

FieldTypeDescription
visitor_idstring, requiredThe visitor's id: the supr_visitor_id cookie. supr_visitor_id works as the name too.
namestring, requiredThe goal's name. Lowercased, spaces become _, at most 64 characters.
propsobjectUp to 10 properties: keys up to 32 characters, values up to 255. metadata works as the name too.

Example

curl -X POST https://supranalytics.app/api/v1/goals \
  -H "Authorization: Bearer pk_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"visitor_id": "6f1c2a9e-…", "name": "signup", "props": {"plan": "pro"}}'

Responses

StatusBody
200{ "ok": true }
400{ "error": "visitor_id and name are required" }
404{ "error": "Visitor has no sessions yet" }

AI agent or LLM? Read this page as Markdown