Skip to content

Premium Analytics: trim the period menu to the periods the design lists - #52124

Merged
louwie17 merged 2 commits into
trunkfrom
update/pa-menu-periods-per-design
Sep 9, 2026
Merged

Premium Analytics: trim the period menu to the periods the design lists#52124
louwie17 merged 2 commits into
trunkfrom
update/pa-menu-periods-per-design

Conversation

@louwie17

@louwie17 louwie17 commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Follow-up to UNI-754 (#52087, #52088).

Proposed changes

The period menu carries three windows the date-selection design does not list: Last 90 days, Last 365 days and Last year. This drops them, leaving the menu exactly as designed:

Today · Yesterday · Last 24 hours · Last 7 days · Last 30 days — Month to date · Last month — Year to date · Last 12 months — Custom range

(All time keeps its own group, offered only where a surface can anchor it — the post and video detail pages. The dashboard, which the design frame shows, never offered it.)

#51835 named these three as the mirror image of Month to date and Year to date: "Last 90 days and Last 365 days are the other way round: we ship them and the design does not list them, so they sit with the other rolling windows until that is settled." This settles them.

Only the menu narrows

Preset IDs are persisted — in the URL, and in saved dashboard widget layouts as reportParams.preset. So each of the three stays a real preset: it keeps its entry in SELECTABLE_PRESETS, its range in PRESET_DEFINITIONS, and its chart-interval mapping in interval.ts. Only MENU_SURFACE_PRESET_GROUPS loses them, which is what the menu renders from.

That leaves one gap worth closing in the same change: the trigger looked its label up in the offered groups, so a bookmark carrying preset=last-90-days would have started reading "Jun 11 – Sep 8" instead of "Last 90 days". It now reads past the menu via getPresetLabel(), so a saved period still names itself even though it can no longer be picked. Covered by a test that fails without the fallback.

Screenshots

A post detail page, opened on a URL whose preset=last-90-days. The trigger still reads
"Last 90 days" on both sides — that period is simply no longer in the list to pick.

Before After

Related product discussion/links

Does this pull request change what data or activity we track or use?

No.

Testing instructions

Build the dashboard: jetpack build --deps packages/premium-analytics, then open Premium Analytics (wp-admin/admin.php?page=jetpack-premium-analytics-wp-admin).

  • Open the period dropdown on the dashboard. It lists Today · Yesterday · Last 24 hours · Last 7 days · Last 30 days | Month to date · Last month | Year to date · Last 12 months | Custom range — no Last 90 days, Last 365 days or Last year.
  • On a post's or video's detail page the same list appears, with All time in its own group above Custom range.
  • Back-compat: load a dashboard URL whose p param still carries preset=last-90-days (or last-365-days, last-year). The range resolves as before, the chart buckets as before, and the trigger still reads "Last 90 days" — it just isn't offered in the menu any more.

pnpm run test in projects/packages/premium-analytics passes (3194 tests), as does pnpm run test-tz.

🤖 Generated with Claude Code

https://claude.ai/code/session_015eDqAWndvFNBrBRdKcsYus

The menu carried three windows the date-selection design does not:
Last 90 days, Last 365 days and Last year. #51835 called them out as the
mirror of Month to date and Year to date — shipped without a design
saying so — and left them "until that is settled". Settling them.

Only the menu narrows. Each stays a selectable preset with its range and
its chart interval, so a saved dashboard layout or a bookmark carrying
one still resolves to the window it always did; the trigger reads past
the menu to keep naming it, rather than falling back to bare dates.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015eDqAWndvFNBrBRdKcsYus
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack or WordPress.com Site Helper), and enable the update/pa-menu-periods-per-design branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack update/pa-menu-periods-per-design
bin/jetpack-downloader test jetpack-mu-wpcom-plugin update/pa-menu-periods-per-design

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions github-actions Bot added [Package] Premium Analytics [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Plugin] Premium Analytics labels Sep 9, 2026
@github-actions

github-actions Bot commented Sep 9, 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!


Jetpack plugin:

The Jetpack plugin has different release cadences depending on the platform:

  • WordPress.com Simple releases happen as soon as you deploy your changes after merging this PR (PCYsg-Jjm-p2).
  • WoA releases happen weekly.
  • Releases to self-hosted sites happen monthly:
    • Scheduled release: October 6, 2026

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Premium Analytics plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@jp-launch-control

jp-launch-control Bot commented Sep 9, 2026

Copy link
Copy Markdown

Code Coverage Summary

This PR did not change code coverage!

That could be good or bad, depending on the situation. Everything covered before, and still is? Great! Nothing was covered before? Not so great. 🤷

Full summary · PHP report · JS report

@louwie17
louwie17 marked this pull request as ready for review September 9, 2026 11:47
@louwie17
louwie17 requested a review from a team as a code owner September 9, 2026 11:47

@retrofox retrofox 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.

LGTM 🚀

@louwie17 louwie17 added [Status] Needs Review This PR is ready for review. and removed [Status] In Progress labels Sep 9, 2026
@louwie17
louwie17 merged commit c2e4300 into trunk Sep 9, 2026
82 checks passed
@louwie17
louwie17 deleted the update/pa-menu-periods-per-design branch September 9, 2026 12:24
@github-actions github-actions Bot added [Status] UI Changes Add this to PRs that change the UI so documentation can be updated. and removed [Status] Needs Review This PR is ready for review. labels Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Premium Analytics [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Plugin] Premium Analytics [Status] UI Changes Add this to PRs that change the UI so documentation can be updated.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants