Skip to content

Premium Analytics: add the Posts & Pages report at /reports/posts#50305

Open
Nikschavan wants to merge 4 commits into
add/wooa7s-1620-traffic-module-report-pagesfrom
add/wooa7s-1620-posts-pages-report-page
Open

Premium Analytics: add the Posts & Pages report at /reports/posts#50305
Nikschavan wants to merge 4 commits into
add/wooa7s-1620-traffic-module-report-pagesfrom
add/wooa7s-1620-posts-pages-report-page

Conversation

@Nikschavan

@Nikschavan Nikschavan commented Jul 8, 2026

Copy link
Copy Markdown
Member

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 + one REPORTS entry in the registry — this is the whole cost of adding a report on the framework.
  • Two tabs (Posts & Pages / Archives) bound to ?section= via the shared defineReportTabs / useSectionTab machinery; the performance chart and the records table both derive from one bucketed top-posts report (config/aggregate.ts, with tests).
  • The top-posts widget gets a "View all" drill-down link to /reports/posts, carrying the dashboard's current date range and comparison.
  • Two data fixes surfaced while building the report:
    • processing/stats/archives.ts — archive buckets with the same label no longer collapse into one row (kept distinct by bucket key, + tests).
    • utils/search.tsnormalizeReportParams now preserves the chart's ?period= param across navigation (+ test).

Adds link on the top posts widget for the link to its report

Posts & Pages report page

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.
  • In the Top Posts widget, click View all — you should land on /reports/posts with the dashboard's date range and comparison intact, and the Stats / Posts & Pages breadcrumb linking back to the same dashboard view.
  • Switch between the Posts & Pages and Archives tabs — the ?section= URL param should update, and reloading the URL should restore the selected tab.
  • On the chart: toggle metrics via the menu, change the time bucket (day/week/month), and collapse/expand the chart.
  • On the table: search, sort by a column, and page through — all client-side, no new requests.
  • Change the date range from the page's date filter — chart and table should update together; the URL should stay shareable (reload restores the exact view).
  • pnpm run test — covers aggregate.ts, the archives bucketing fix, and the period param preservation.

@jp-launch-control

jp-launch-control Bot commented Jul 8, 2026

Copy link
Copy Markdown

Code Coverage Summary

No summary data is available for parent commit 2a40c65, so cannot calculate coverage changes. 😴

If that commit is a feature branch rather than a trunk commit, this is expected. Otherwise, this should be updated once coverage for 2a40c65 is available.

Full summary · PHP report

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

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:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!

@github-actions github-actions Bot added the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label Jul 8, 2026
@Nikschavan Nikschavan force-pushed the add/wooa7s-1620-posts-pages-report-page branch from 8a6f3bf to 175fff9 Compare July 8, 2026 07:54
@Nikschavan Nikschavan marked this pull request as ready for review July 8, 2026 07:57
@Nikschavan Nikschavan requested review from a team as code owners July 8, 2026 07:57
Copilot AI review requested due to automatic review settings July 8, 2026 07:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 posts report in the reports registry and add the /reports/posts report 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 period in normalizeReportParams and 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).

Comment on lines 13 to 15
"@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.
@Nikschavan Nikschavan force-pushed the add/wooa7s-1620-posts-pages-report-page branch from 175fff9 to 2d67051 Compare July 8, 2026 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Premium Analytics [Status] In Progress [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants