Skip to content
dimmiDocs

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.

Send events to POST /api/v1/contact-events using an API token with contacts:write:

Terminal window
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, or external_id (the sub claim from their identity token).
  • Avoid duplicates: dimmi deduplicates matching idempotency_key values for 48 hours.
  • Batch events: wrap up to 100 events in an events array to send them in one request.
src/checkout.ts
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).