Premium Analytics: add the Posts & Pages report at /reports/posts#50305
Premium Analytics: add the Posts & Pages report at /reports/posts#50305Nikschavan wants to merge 4 commits into
Conversation
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! |
8a6f3bf to
175fff9
Compare
There was a problem hiding this comment.
Pull request overview
Adds the first “view all” report page to the Premium Analytics reports framework: a Posts & Pages report at /reports/posts, wired from the Top Posts widget and backed by shared chart/table aggregation.
Changes:
- Register the new
postsreport in the reports registry and add the/reports/postsreport page module with tabs, chart, and DataViews table. - Add a “See report” drill-down link from the Top Posts widget, carrying date/comparison params via URL search.
- Fix/extend data normalization to preserve
periodinnormalizeReportParamsand correct archive bucket interval dating.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| projects/packages/premium-analytics/widgets/top-posts/style.module.css | Add layout styles to support a footer “See report” link. |
| projects/packages/premium-analytics/widgets/top-posts/render.tsx | Add report drill-down link and route-search building; switch external link usage for row labels. |
| projects/packages/premium-analytics/widgets/top-posts/package.json | Add new dependencies for routing (and currently an unused date-fns). |
| projects/packages/premium-analytics/widgets/top-posts/tests/top-posts.test.tsx | Mock router link and assert drill-down URL carries expected params. |
| projects/packages/premium-analytics/routes/reports/registry.ts | Register the posts report with title/description/section resolver + lazy load. |
| projects/packages/premium-analytics/routes/reports/posts/page.tsx | Implement Posts & Pages report page (tabs, date filters, chart, records table). |
| projects/packages/premium-analytics/routes/reports/posts/page.module.css | Add page layout/padding and date filter container sizing. |
| projects/packages/premium-analytics/routes/reports/posts/config/tabs.ts | Define Posts & Pages / Archives tabs and resolver for ?section=. |
| projects/packages/premium-analytics/routes/reports/posts/config/index.ts | Export posts report config surface (fields, aggregation, tabs). |
| projects/packages/premium-analytics/routes/reports/posts/config/fields.tsx | Define DataViews field configs for posts and archives tables (incl. link rendering). |
| projects/packages/premium-analytics/routes/reports/posts/config/aggregate.ts | Aggregate bucketed reports into chart series + table rows for both tabs. |
| projects/packages/premium-analytics/routes/reports/posts/config/aggregate.test.ts | Add tests for time-series date preservation and archive row flattening. |
| projects/packages/premium-analytics/routes/reports/package.json | Add dependencies needed by the new report route/page implementation. |
| projects/packages/premium-analytics/packages/data/src/utils/search.ts | Preserve period from URL search in normalizeReportParams. |
| projects/packages/premium-analytics/packages/data/src/utils/tests/normalize-report-params.test.ts | Add coverage for period preservation. |
| projects/packages/premium-analytics/packages/data/src/processing/stats/archives.ts | Fix non-summarized bucket interval fields to be per-bucket (not top-level). |
| projects/packages/premium-analytics/packages/data/src/processing/stats/tests/archives.test.ts | Add regression test ensuring bucket dates don’t collapse across buckets. |
| projects/packages/premium-analytics/changelog/add-wooa7s-1620-posts-pages-report-page | Add changelog entry for the new report page (URL currently mismatched). |
| "@wordpress/widget-primitives": "0.2.0", | ||
| "date-fns": "4.1.0", | ||
| "react": "18.3.1" |
| } | ||
|
|
||
| return ( | ||
| <a href={ item.link } target="_blank" rel="noreferrer"> |
| Significance: minor | ||
| Type: added | ||
|
|
||
| Add the Posts & Pages report page at /report/posts with Posts & Pages and Archives tabs, date-range and comparison controls, a performance chart, a Core DataViews records table, and a Top pages by views widget link. |
…eport The /reports/$report stage now mounts React Query, global errors, and the chart theme for every report page, so the posts page drops its own AnalyticsQueryClientProvider and GlobalErrorProvider.
175fff9 to
2d67051
Compare
Part of WOOA7S-1620
Stack 3/3 — base:
add/wooa7s-1620-traffic-module-report-pages(#50304). Replaces #50171.Proposed changes
The first registry entry, proving the framework end-to-end: a Posts & Pages report at
/reports/posts.routes/reports/posts/page module + oneREPORTSentry in the registry — this is the whole cost of adding a report on the framework.?section=via the shareddefineReportTabs/useSectionTabmachinery; the performance chart and the records table both derive from one bucketed top-posts report (config/aggregate.ts, with tests)./reports/posts, carrying the dashboard's current date range and comparison.processing/stats/archives.ts— archive buckets with the same label no longer collapse into one row (kept distinct by bucket key, + tests).utils/search.ts—normalizeReportParamsnow preserves the chart's?period=param across navigation (+ test).Adds link on the top posts widget for the link to its report
Does this pull request change what data or activity we track or use?
No.
Testing instructions
cd projects/packages/premium-analytics && pnpm run build, open the Premium Analytics dashboard on a site with traffic data./reports/postswith the dashboard's date range and comparison intact, and theStats / Posts & Pagesbreadcrumb linking back to the same dashboard view.?section=URL param should update, and reloading the URL should restore the selected tab.pnpm run test— coversaggregate.ts, the archives bucketing fix, and theperiodparam preservation.