Send events
Record a signup, purchase or any other action from your server with one request.
{ "status": "success", "type": "custom_event", "count": 1 }The key needs the track:events scope. Without a key, pass your Client ID as ?website_id= or websiteId, as the browser tracker does. In Node, the Node SDK wraps this for you.
Fill in an event
Keep property values to strings, numbers and booleans, and leave out personal data.
Send a batch
Send an array of up to 100 events, at most 1 MB of JSON in total. Valid events are kept even when others fail, and the failures come back in rejected:
{
"status": "success",
"type": "custom_event",
"count": 1,
"rejected": [{ "index": 1, "eventId": "evt_2", "error": "1.name: Too small: expected string to have >=1 characters" }]
}Fix and resend only the rejected events. The request fails with 400 only when no event in it is valid.
Identify users and accounts
{ "groupType": "workspace", "groupKey": "ws_123", "traits": { "name": "Databuddy", "billing_mrr": 49, "billing_currency": "USD" } }Both accept a track:events key or a Client ID; websiteId is required with a key. billing_ traits and account usage traits need a key, so a browser can't change what a customer pays.
Fix errors
Errors carry code, message, requestId and retryable, which is true for 429 and 5xx.
Related
How is this guide?