Get website traffic stats
umami_get_statsRetrieve website traffic summaries for any date range, including pageviews, visitors, visits, and bounce rate. Optionally compare to the previous period to measure change.
Instructions
Get summary traffic statistics for a website over a date range, with optional comparison to the immediately preceding period.
This is the headline-numbers tool: pageviews, visitors, visits, bounce rate, and average visit duration. Bounce rate and average visit duration are derived here, since Umami returns raw bounce and total-time counts.
Args:
website (string, optional): Website ID, name, or domain.
range (string): Date range, default '7d'. Relative ('24h', '7d', '30d'), named ('today', 'yesterday', 'last_week', 'last_month', 'mtd', 'ytd'), or use start_date/end_date.
start_date / end_date (string, optional): Explicit bounds, overriding 'range'.
compare (boolean): Also return the previous period of equal length with percent change (default: true).
filters (object, optional): Segment filters such as { country: 'US', path: '/pricing' }.
timezone (string, optional): IANA timezone for day boundaries.
response_format ('markdown' | 'json'): Output format (default: 'markdown').
Returns: JSON shape: { "website_id": string, "range": { "start": string, "end": string }, "stats": { "pageviews": number, "visitors": number, "visits": number, "bounces": number, "totaltime": number, "bounce_rate_pct": number, "views_per_visit": number, "avg_visit_duration_seconds": number }, "previous": { ...same fields... } | null, "change": { "pageviews": string, "visitors": string, "visits": string, "bounce_rate_pct": string } | null }
Examples:
"How did the site do last month?" -> range="last_month"
"Traffic from mobile users in the US this week" -> range="this_week", filters={ device: "mobile", country: "US" }
"Compare this month to last" -> range="mtd", compare=true
Error handling:
Returns a 404 error if the website ID does not exist.
All-zero results usually mean the range predates tracking; check umami_get_website for the available data range.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| 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. | |
| compare | No | Include the previous period of equal length with percent change. | |
| 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'. | |
| timezone | No | IANA timezone for bucketing and day boundaries, e.g. 'America/New_York'. Defaults to UMAMI_TIMEZONE. | |
| 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 |