View Source PlausibleWeb.StatsController (Plausible v0.0.1)
This controller is responsible for rendering stats dashboards.
The stats dashboards are currently the only part of the app that uses client-side rendering. Since the dashboards are heavily interactive, they are built with React which is an appropriate choice for highly interactive browser UIs.
This reasoning for this sequence is as follows:
- First paint is fast because it doesn't do any data aggregation yet - good UX
- The basic structure of the dashboard is rendered with spinners before reports are ready - good UX
- Rendering on the frontend allows for maximum interactivity. Re-rendering and re-fetching can be as granular as needed.
- Routing on the frontend allows the user to navigate the dashboard without reloading the page and losing context
- Rendering on the frontend allows caching results in the browser to reduce pressure on backends and storage 3.1 No client-side caching has been implemented yet. This is still theoretical. See https://github.com/plausible/analytics/discussions/1278 3.2 This is a big potential opportunity, because analytics data is mostly immutable. Clients can cache all historical data.
- Since frontend rendering & navigation is harder to build and maintain than regular server-rendered HTML, we don't use SPA-style rendering anywhere else .The only place currently where the benefits outweigh the costs is the dashboard.
Summary
Functions
The export is limited to 300 entries for other reports and 100 entries for pages because bigger result sets start causing failures. Since we request data like time on page or bounce_rate for pages in a separate query using the IN filter, it causes the requests to balloon in payload size.
Authorizes and renders a shared link
Functions
The export is limited to 300 entries for other reports and 100 entries for pages because bigger result sets start causing failures. Since we request data like time on page or bounce_rate for pages in a separate query using the IN filter, it causes the requests to balloon in payload size.