Revenue events
tracing("purchase", { revenue: 49, currency: "USD", plan: "pro" });tracing.revenue(49, "USD", { plan: "pro" });Both lines produce one event of type revenue carrying 4900 minor units of
USD and a plan property. The first keeps the name you gave it; the second
is named revenue.
Form one: a revenue property
Section titled “Form one: a revenue property”tracing(name: string, props: { revenue: number; currency?: string; [key: string]: string | number | boolean })Any custom event whose properties include a numeric revenue is sent as a
revenue event instead of a plain custom event. The tracker lifts revenue and
currency out of the properties, converts the amount to minor units and sends
the rest of the properties unchanged. A string revenue is not lifted; it is
stored as an ordinary property and the event stays custom.
| Property | Notes |
|---|---|
revenue |
In major units: 49 means forty-nine dollars, 49.99 forty-nine dollars and ninety-nine cents |
currency |
ISO 4217, case-insensitive, uppercased before sending. Defaults to USD |
| anything else | Stored as event properties, same rules and limits |
This is the form to use when the event already has a meaningful name:
purchase, upgrade, donation, order_completed.
Form two: tracing.revenue()
Section titled “Form two: tracing.revenue()”tracing.revenue(amount: number, currency = "USD", props?: Record<string, string | number | boolean>)| Argument | Notes |
|---|---|
amount |
In major units |
currency |
ISO 4217, case-insensitive. Defaults to USD |
props |
Optional properties. A name property renames the event; it is used as the event name and kept as a property |
The event name defaults to revenue.
Minor units
Section titled “Minor units”The amount is converted to the currency’s minor unit before it is sent, and a minor unit is not always one hundredth:
| Currency group | Factor | Example |
|---|---|---|
Zero-decimal: BIF DJF GNF JPY KMF KRW MGA PYG RWF UGX VND VUV XAF XOF XPF CLP |
×1 | tracing.revenue(1200, "JPY") → 1200 |
Three-decimal: BHD IQD JOD KWD LYD OMR TND |
×1000 | tracing.revenue(1.5, "KWD") → 1500 |
| Everything else | ×100 | tracing.revenue(49, "USD") → 4900 |
The result is rounded to the nearest integer. The API and the CSV export report minor units.
What it produces
Section titled “What it produces”One event row of type revenue, carrying the amount and currency. It:
- counts towards your monthly event allowance;
- belongs to the visit it fired in and inherits the visit’s referrer, campaign, landing page, country and device, which is how the Revenue screen breaks money down;
- appears in the visit’s timeline on Sessions and is added to the visit’s own revenue figure when its currency is the site currency;
- appears in the Events explorer with its amount;
- counts as a conversion for a goal that matches its name, and the goal reports the amount as its value.
Related
Section titled “Related”- Tracking revenue for the setup walkthrough
- Revenue screen
- How attribution works