compare_periods
Compare aggregate metrics between two time periods side by side, showing absolute and percentage changes. Use for before-and-after analysis like yesterday vs the day before or this week vs last week.
Instructions
Compare aggregate metrics between two periods side by side, with absolute and % deltas. Great for 'yesterday vs the day before', 'this week vs last week', or before/after a deploy. Both periods accept the same friendly keywords as date_range.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| site_id | No | Site domain (e.g. example.com). | |
| period_a | Yes | Baseline period (the 'before'). Time period. Friendly keywords (resolved in the site's own timezone): today, yesterday, this_week, last_week, this_month, last_month, this_year, last_year, last_7_days, last_30_days, last_90_days, last_12_months. Also accepts Plausible presets (day, 7d, 30d, month, 6mo, 12mo, year, all), a single date "YYYY-MM-DD", or an explicit range "YYYY-MM-DD,YYYY-MM-DD". For "yesterday"/"last week" etc., prefer the keyword — the server computes the exact dates so you don't have to know today's date. | |
| period_b | Yes | Comparison period (the 'after'). Time period. Friendly keywords (resolved in the site's own timezone): today, yesterday, this_week, last_week, this_month, last_month, this_year, last_year, last_7_days, last_30_days, last_90_days, last_12_months. Also accepts Plausible presets (day, 7d, 30d, month, 6mo, 12mo, year, all), a single date "YYYY-MM-DD", or an explicit range "YYYY-MM-DD,YYYY-MM-DD". For "yesterday"/"last week" etc., prefer the keyword — the server computes the exact dates so you don't have to know today's date. | |
| metrics | No | Metrics to compare. | |
| filters | No | Plausible v2 filters (applied to both). |