Get revenue attributed from a custom event property
umami_get_revenueCalculate total and average revenue from numeric custom-event properties, such as purchase amounts, to measure earnings without built-in revenue tracking.
Instructions
Get total and average revenue from a numeric custom-event property, e.g. an 'amount' field on a 'purchase' event.
Self-hosted Umami has no built-in revenue tracking. This works by reading the distribution of a numeric property recorded on a custom event, via umami.track(event_name, { [property]: amount }). It sums (value x occurrence count) across every recorded value.
Args:
website (string, optional): Website ID, name, or domain.
event (string, required): Custom event name, e.g. 'purchase'.
property (string, required): Numeric property on that event holding the amount, e.g. 'amount'.
range (string): Date range, default '30d'.
start_date / end_date (string, optional): Explicit bounds, overriding 'range'.
filters (object, optional): Segment filters, e.g. { utmSource: 'google' } for revenue by campaign.
response_format ('markdown' | 'json'): Output format (default: 'markdown').
Returns: JSON shape: { "event": string, "property": string, "total_revenue": number, "transaction_count": number, "average_value": number }
Error handling:
total_revenue of 0 usually means the tracker has never called umami.track(event, { property: number }) in this range, not an error. Check umami_get_metrics with type='event' to confirm the event fires at all.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| event | Yes | Custom event name, e.g. 'purchase'. | |
| range | No | Date range for the query, default '7d'. Relative ("30m", "24h", "7d", "4w", "3mo", "1y"), named ("today", "yesterday", "this_week", "last_week", "this_month", "last_month", "this_year", "last_year", "mtd", "ytd", "all_time"), or an explicit ISO date via start_date/end_date. | |
| filters | No | Optional segment filters. Supported keys: path, referrer, title, query, browser, os, device, country, region, city, language, hostname, tag, event, distinctId, utmSource, utmMedium, utmCampaign, utmContent, utmTerm, segment, cohort. Example: { country: 'US', device: 'mobile' }. | |
| website | No | Website ID (UUID), name, or domain. Optional if UMAMI_DEFAULT_WEBSITE is set. Use umami_list_websites to discover values. | |
| end_date | No | Explicit end date (YYYY-MM-DD, ISO 8601 timestamp, or epoch ms). Overrides 'range'. | |
| property | Yes | Numeric event property holding the amount, e.g. 'amount'. | |
| start_date | No | Explicit start date (YYYY-MM-DD, ISO 8601 timestamp, or epoch ms). Overrides 'range'. | |
| response_format | No | Output format: 'markdown' for a readable summary, 'json' for raw structured data. | markdown |