What you’ll build
A backend service that:- Captures domain events as they happen.
- Forwards each one to Spotzee with the user’s
external_id. - Batches when traffic is bursty and retries on failure.
Prerequisites
You’ll need a
sk_ project key with write access. The browser-side equivalent uses a pk_ publishable key. See Authentication.Walkthrough
1
Pick stable user IDs
Identify each event with the same
external_id you used to sync the user. If the user is anonymous (a not-yet-signed-up visitor), use anonymous_id instead. Spotzee stitches the two together when the user later identifies.2
Choose an event name
Use snake_case verbs:
order_placed, subscription_renewed, feature_enabled. Stick to a small catalogue. Every event you create is a hook journeys and segments can depend on, so churn in event names breaks downstream automation.3
Send events
POST /events accepts a JSON array of one to 100 events per call. Even when sending a single event, wrap it in an array.4
Batch when you can
For high-volume sources (queue consumers, ETL jobs, replay scripts), pack up to 100 events into a single call:
5
Add user details alongside the event (optional)
If the event also reveals new user information (say, a checkout that finally captures the user’s email), include a The
user block. Spotzee upserts the user in the same call, so a downstream segment that depends on email IS NOT NULL fires correctly.user block accepts email, phone, timezone, locale, and a data object for custom attributes.6
Retry safely on failure
Network blips happen. Add an
Idempotency-Key so a retry doesn’t double-count an event in reporting. A deterministic key (order_placed:ord_42) is easier than a UUID for replay scenarios. See Idempotency.Pitfalls to avoid
- Don’t send “view” events from your backend unless you have a real reason to. Page views belong in browser-side tracking with a
pk_key. Backend events should reflect domain transitions: orders, subscriptions, status changes. - Don’t churn the schema. If you add a field to
data, keep it. Removing it breaks segments and journeys that already depend on it. - Don’t forget
Spotzee-Version. It’s optional, but pinning a version makes your event payload’s behaviour predictable across releases. See API versioning.
Reference
- API surface: see Main API → Events
- Browser-side tracking: see Authentication → publishable keys
- Safe retries: see Idempotency
- Rate limits: see Rate limits