mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-04 21:54:41 +08:00
This commit adds a new parallel page view counting system that uses `fetch` with `keepalive: true` to POST to a dedicated `/srv/pv` endpoint, gated behind the `use_beacon_for_browser_page_views` site setting.
Unlike the existing deferred tracking (which piggybacks on AJAX headers), the beacon approach sends page view data directly as a JSON body. Both systems run simultaneously when the setting is enabled to allow comparing counts before fully migrating.
Key details:
* New middleware endpoint `POST /srv/pv` short-circuits with 204
* Dedicated `ApplicationRequest` counters (`*_beacon`) track beacon page views separately from the existing browser page view counters
* A separate `:beacon_browser_pageview` DiscourseEvent avoids double-firing with the existing `:browser_pageview` event
* On Ember route transitions, `routeDidChange` sends the beacon. For non-Ember pages (e.g. `/pub/*`), `pageview.js` handles it
Internal topic: t/179398.
|
||
|---|---|---|
| .. | ||
| about | ||
| admin/backups | ||
| application | ||
| badges | ||
| categories | ||
| common | ||
| default | ||
| dev_mode | ||
| embed | ||
| exceptions | ||
| finish_installation | ||
| groups | ||
| home_page | ||
| invites | ||
| layouts | ||
| list | ||
| metadata | ||
| offline | ||
| posts | ||
| published_pages | ||
| qunit | ||
| robots_txt | ||
| safe_mode | ||
| search | ||
| session | ||
| sitemap | ||
| static | ||
| tags | ||
| topics | ||
| user_api_keys | ||
| user_notifications | ||
| users | ||