Messenger
Track customer events
Record product actions like order.placed or checkout.started from your server API or the browser messenger.
Tracked events power audiences, trigger series, and emit the contact_event.tracked webhook.
Event names use 1 to 64 lowercase letters, digits, and _ . : -. Optional metadata supports up to 20 keys and 2 KB per event.
Track events from your server
Section titled “Track events from your server”Send events to POST /api/v1/contact-events using an API token with contacts:write:
curl -X POST https://trydimmi.com/api/v1/contact-events \ -H "Authorization: Bearer <api_token>" \ -H "Content-Type: application/json" \ -d '{ "name": "order.placed", "external_id": "42", "metadata": { "order_id": "A-1001", "total": 129.5 }, "idempotency_key": "order-A-1001" }'- Identify the customer: pass one of
contact_id,email, orexternal_id(thesubclaim from their identity token). - Avoid duplicates: dimmi deduplicates matching
idempotency_keyvalues for 48 hours. - Batch events: wrap up to 100 events in an
eventsarray to send them in one request.
Track events from the browser
Section titled “Track events from the browser”import { getDimmi } from "@dimmi/browser";
getDimmi().trackEvent("checkout.started", { plan: "team", seats: 5 });Using the script tag instead? Call Dimmi("track", "checkout.started", { plan: "team", seats: 5 }).
Because anyone can call browser JavaScript, dimmi only accepts browser event names you enable under Settings → Attributes → Events (unless you turn on Accept any event from the messenger). Always send security-sensitive or billing events from your server.
The messenger queues browser events until the visitor has an active session (signed in, or previously started a chat).