Skip to main content

Track a sale event

Track a sale for a short link.
1 min read
post/track/sale
Request example
Response
post/track/sale
Note

Conversion tracking requires a Business plan subscription or higher.

Authorization

Authorizationstringheaderrequired#
Default authentication mechanism

Body

application/json
customerExternalIdstringrequired#
The unique ID of the customer in your system. Will be used to identify and attribute all future events to this customer.

Length: 1–100

amountintegerrequired#
The amount of the sale in cents (for all two-decimal currencies). If the sale is in a zero-decimal currency, pass the full integer value (e.g. 1580 JPY). Learn more: https://d.to/currency

Range: 0–9007199254740991

currencystring#
The currency of the sale. Accepts ISO 4217 currency codes. Sales will be automatically converted and stored as USD at the latest exchange rates. Learn more: https://d.to/currency

Default: "usd"

eventNamestring#
The name of the sale event. Recommended format: Invoice paid or Subscription created.

Default: "Purchase"

Length: max 255

paymentProcessorenum<string>#
The payment processor via which the sale was made.

Default: "custom"

Options:stripeshopifypolarpaddleapplerevenuecatlemonsqueezydubcustom
invoiceIdstring#
The invoice ID of the sale. Can be used as a idempotency key – only one sale event can be recorded for a given invoice ID.

Default: null

metadataobject#
Additional metadata to be stored with the sale event. Max 10,000 characters when stringified.

Default: null

Show child attributes
{key}any#
leadEventNamestring#
The name of the lead event that occurred before the sale (case-sensitive). This is used to associate the sale event with a particular lead event (instead of the latest lead event for a link-customer combination, which is the default behavior). For direct sale tracking, this field can also be used to specify the lead event name.

Default: null

clickIdstring#
[For direct sale tracking]: The unique ID of the click that the sale conversion event is attributed to. You can read this value from dub_id cookie.
customerNamestring#
[For direct sale tracking]: The name of the customer. If not passed, a random name will be generated (e.g. “Big Red Caribou”).

Default: null

Length: max 100

customerEmailstring#
[For direct sale tracking]: The email address of the customer.

Default: null

Length: max 100Pattern: ^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$

customerAvatarstring#
[For direct sale tracking]: The avatar URL of the customer.

Default: null

Responses

application/json
A sale was tracked.
eventNamestringrequired#
customerobjectrequired#
Show child attributes
idstringrequired#
namestringrequired#
emailstringrequired#
avatarstringrequired#
externalIdstringrequired#
saleobjectrequired#
Show child attributes
amountnumberrequired#
currencystringrequired#
paymentProcessorstringrequired#
invoiceIdstringrequired#
metadataobjectrequired#
Show child attributes
{key}any#