track.* records a signal and the SDK sends it for you. It never
throws or waits for the network: call it without await, from the click
handler.
The methods
All of them take the recommendation (in the API,Decision: the list of products recommended for that moment)
or its decision_id. Except for the impression and checkout, they also take the result (or its item_id).
Each method returns the signal id, or
undefined if it couldn’t be built
(onSignalError says why). They accept signalId, your own stable id;
cartId, which overrides the instance’s; and occurredAt, now by default.
A purchase isn’t a signal
Your store’s order says a sale closed, not the browser. For CrossUp to tie it to the recommendation, give it the cart id once, when creating the instance; it travels on every request and every signal:checkoutStarted and cartId aren’t in the version published on npm yet
(0.1.0), which ships a track.purchase the contract no longer accepts.
Until the next version, send checkout_started and cart_id through the
API.Listen to the results
If you don’t see it
Signals and attribution
When to send each signal and what CrossUp measures with them.
Record signals via the API
The operation, with a playground.