A portable analytics dashboard for WordPress sites with Jetpack connection. Renders as an SPA inside wp-admin using route-based code splitting.
Analytics::init()
│
├── loads build/build.php (generated by @wordpress/build)
├── registers jetpack-premium-analytics-wp-admin
│ gated by jetpack_view_analytics
│
▼
@wordpress/boot ← SPA shell and routing
│
▼
routes/<name>/stage.tsx ← each route is a lazy-loaded ES module
Boot mounts inside the standard admin chrome; routes are discovered at
build time from package.json metadata.
The generated full-page variant is disabled; only the registered, capability-gated admin page serves the dashboard.
- PHP >= 7.4
- WordPress core or Jetpack's wp-build polyfills provide the WordPress script handles/modules used by the dashboard. The Gutenberg plugin is not required.
pnpm run build # one-off build
pnpm run watch # rebuild on file changes
jetpack build packages/premium-analytics # via Jetpack CLI-
Create
routes/<name>/package.json:{ "name": "<name>-route", "route": { "path": "/<name>", "page": "jetpack-premium-analytics" } } -
Create
routes/<name>/stage.tsxexportingstage():export const stage = () => <div>My new page</div>;
-
Rebuild — routes are auto-discovered from
package.jsonmetadata.
@wordpress/build 0.10+ stopped bundling @wordpress/boot locally,
but the generated page.php template still looks for
modules/boot/index.min.asset.php to resolve classic script
prerequisites. Without it the page is blank.
Package automattic/jetpack-wp-build-polyfills provides a fixed version.
Serves two purposes:
- Sets the dashboard menu icon via
@wordpress/bootstore - Forces
@wordpress/buildto track@wordpress/bootas a module dependency — without an init module that imports boot, the build skips it
premium-analytics/
├── src/
│ └── class-analytics.php # PHP entry: loads build, registers menu
├── packages/
│ └── init/ # runs before routes render
├── routes/
│ └── dashboard/ # dashboard route (/)
│ └── stage.tsx
├── shims/
│ └── boot-asset.php # boot prereqs workaround
├── composer.json # automattic/jetpack-premium-analytics
├── package.json # @wordpress/build config
└── build/ # generated (gitignored)