Get conversion rate toward a goal
umami_get_goalCalculate conversion rates for single-step goals by comparing visitors who reached a target page or triggered a custom event against all visitors within a selected date range.
Instructions
Get the conversion rate for a single-step goal: visitors who reached a page, versus all visitors in the same range.
A goal is either a page ('path') or a custom event ('event'). Pass exactly one. Umami has no dedicated goals feature, so this is computed by comparing two filtered calls to the stats endpoint.
Args:
website (string, optional): Website ID, name, or domain.
path (string): Goal is reaching this page, e.g. '/thank-you'. Exactly one of path/event required.
event (string): Goal is firing this custom event, e.g. 'signup'. Exactly one of path/event required.
range (string): Date range, default '7d'.
start_date / end_date (string, optional): Explicit bounds, overriding 'range'.
filters (object, optional): Segment filters applied to both the goal and the baseline, e.g. { country: 'US' }.
response_format ('markdown' | 'json'): Output format (default: 'markdown').
Returns: JSON shape: { "goal": { "type": "path"|"event", "value": string }, "baseline_visitors": number, "goal_visitors": number, "conversion_rate_pct": number }
Examples:
"What % of visitors reach the thank-you page?" -> path="/thank-you"
"Conversion rate on the signup event this month" -> event="signup", range="this_month"
Error handling:
A goal event with zero occurrences usually means the tracker never fired umami.track(event_name) in the range, not an error.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | Goal page path, e.g. '/thank-you'. | |
| event | No | Goal custom event name, e.g. 'signup'. | |
| 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'. | |
| 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 |