mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-26 03:01:14 +08:00
Makes the redesigned dashboard Site traffic section real for the core
traffic summary.
- In scope: live pageview headline, comparison trend, logged-in share
KPI, and stacked traffic chart.
- Out of scope: top referrers, top countries, and narrative traffic
insights. Those remain placeholder UI for a follow-up.
- Reuses the existing report stacked chart for both the dashboard
section and `/admin/reports/site_traffic`.
- Extends the existing site traffic report data contract instead of
introducing a dashboard-only chart shape.
- Keeps traffic aggregation, KPI calculation, and trend eligibility on
the backend.
- Supports dashboard preset and custom date ranges with inclusive date
windows.
- Ships traffic data in this section payload shape:
```json
{
"id": "traffic",
"data": {
"kpis": {
"browser_pageviews": {
"value": 30,
"percent_change": 900,
"comparison_period": {
"start_date": "2026-04-28",
"end_date": "2026-04-30"
}
},
"logged_in_share": {
"value": 33
}
},
"pageview_series": [
{
"req": "page_view_logged_in_browser",
"label": "Logged in",
"color": "#4B3CE0",
"data": [
{ "x": "2026-05-01", "y": 10 }
]
}
]
}
}
```
|
||
|---|---|---|
| .. | ||
| site_traffic_section_spec.rb | ||