Track a sale
track_saleRecord a sale conversion for a short link to attribute revenue to the correct click, customer, and payment processor.
Instructions
Track a sale for a short link.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| amount | No | 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 | |
| account | No | Exact configured private workspace profile label; not a tenant or provider account ID. | |
| clickId | No | [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. | |
| confirm | No | Must be true for the requested mutation or exclusive private output file. | |
| payload | No | Complete native JSON body; do not mix with body flags or payload_file. Arrays use repeated JSON object flags or a whole native array in a private file. | |
| currency | No | 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 | usd |
| metadata | No | Additional metadata to be stored with the sale event. Max 10,000 characters when stringified. | |
| eventName | No | The name of the sale event. Recommended format: `Invoice paid` or `Subscription created`. | Purchase |
| invoiceId | No | 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. | |
| customerName | No | [For direct sale tracking]: The name of the customer. If not passed, a random name will be generated (e.g. “Big Red Caribou”). | |
| payload_file | No | Absolute regular non-symlink JSON body file, at most 1 MiB. Cannot mix with payload/body flags. | |
| customerEmail | No | [For direct sale tracking]: The email address of the customer. | |
| leadEventName | No | 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. | |
| customerAvatar | No | [For direct sale tracking]: The avatar URL of the customer. | |
| paymentProcessor | No | The payment processor via which the sale was made. | custom |
| customerExternalId | No | The unique ID of the customer in your system. Will be used to identify and attribute all future events to this customer. |