Server events
Server events are sent from your backend straight to Chord when something happens to an order: it's placed, cancelled, refunded or shipped. They don't depend on the shopper's browser, so ad blockers and closed tabs can't stop them, and they're the reliable record of what was sold.
Your backend sends each event as an HTTP request to Chord's events endpoint. This page walks through it.
Step 1: Get your endpoint and write key
Ask Chord for:
Your CDP domain, such as
https://production.cdp.ingest.chord.co.A server-side write key. It's different from the write key your storefront uses. Keep it secret: store it with your other backend credentials, never in browser code.
Server events go to these endpoints on your CDP domain:
Track (something happened):
/api/trackIdentify (who a customer is):
/api/identify
Step 2: Send events when they happen
Send a track event from your backend each time one of these happens. Each event's page in the tracking plan lists its properties.
An order is placed: Order Completed
An order is cancelled: Order Cancelled
An order is refunded: Order Refunded
An order ships: Shipment Shipped
An order is delivered: Shipment Delivered
A customer creates an account: User Created
If you sell subscriptions, send the subscription events in the tracking plan too, such as Subscription Created and Subscription Payment Failed.
Every track request carries:
type(required):trackevent(required): the event name, such asOrder Completedproperties: the event's properties from the tracking planuserId: your ID for the customer, if they have an accountanonymousId: the browser's anonymous ID (see step 3)
Send your write key in the X-Write-Key header. Here's a complete Order Completed request:
Chord adds timestamp, receivedAt and messageId to each event. Send your own timestamp if the event happened earlier than you're sending it, for example when you replay a queue.
Step 3: Link events to the browser session
Your backend's events and the shopper's browser events are separate streams. To join them, pass the browser's anonymous ID along with the order:
On the storefront, read the anonymous ID that
@chordcommerce/analyticsgave the shopper. It's in the__eventn_idcookie.Save it on the cart or order in your platform, for example as a custom attribute, before the shopper reaches checkout.
In your backend, send it as
anonymousIdon every server event for that order.
Without it, Chord can't connect an order to the browsing and ad clicks that led to it.
Step 4: Identify the customer
Server events carry no browser context, so destinations that match customers by email, phone or address only get those details if you send them. When an order is placed or an account is created, send an identify call with the customer's details:
Use these trait names: first_name, last_name, and address1, address2 and zipcode for addresses. Always include email if you have it; it's what most destinations match on. See the Context object for every trait.
An identify call updates the customer's profile. It isn't an event, so it can't trigger automations in destinations. On account creation, send both an identify and a User Created event.
Step 5: Verify
Send a test Order Completed from your backend.
In Chord, open Live Events for your back-end source and check that it arrived with the right properties.
Place a real test order through your storefront, and check that its Order Completed carries the same
anonymousIdas the browser events from that session.
Last updated
Was this helpful?