Skip to content

Premium Analytics: drop the grouping control from the WordAds chart - #52483

Merged
retrofox merged 5 commits into
trunkfrom
update/wordads-chart-drop-grouping
Sep 18, 2026
Merged

retrofox merged 5 commits into
trunkfrom
update/wordads-chart-drop-grouping

Conversation

@retrofox

@retrofox retrofox commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Fixes WOOA7S-2158

Proposed changes

The WordAds chart on the Ads tab now offers the same header controls as the Subscribers chart: the period, then a line or bar toggle.

  • Drop the grouping control (by day, week or month). The chart picks its grouping from the selected period: Last 7 days and Last 30 days by day, Last 12 months by month, and a custom range by its length (by week from 90 days, by month from a year).
  • An instance saved with a grouping still loads, and draws with its period's grouping rather than the stored one, which nothing can change anymore.
  • Add the line or bar toggle, saved on the widget as on the Subscribers chart.
  • The periods on offer are unchanged: Last 7 days, Last 30 days, Last 12 months and Custom range.

Out of scope: the wordads/stats endpoint anchors monthly windows to today, which may add leading months to Last 12 months. That predates this PR and is tracked on WOOA7S-2158.

Related product discussion/links

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

No.

Testing instructions

Setup

  1. Check out this branch and build Premium Analytics: jetpack build --deps packages/premium-analytics.
  2. Open the Premium Analytics dashboard on a site with WordAds active, and go to the Ads tab.

Header

  1. Confirm the WordAds chart header shows the period dropdown followed by the line and bar toggle, with no grouping control.
  2. Switch to bars. Confirm the chart redraws as bars, and still does after reloading the page.

Grouping

  1. With the browser's network panel open, pick each period and check the wordads/stats request:
    • Last 7 days and Last 30 days: unit=day.
    • Last 12 months: unit=month.
    • Custom range of about four months: unit=week; of more than a year: unit=month.

Saved grouping

  1. On trunk, pick Last 30 days and group the chart by weeks.
  2. Check out this branch, rebuild, and reload. Confirm the chart loads and draws by day.
Screen.Recording.2026-09-18.at.12.46.25.PM.mov

drop the grouping control and add a line or bar toggle
@retrofox retrofox added Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Status] In Progress labels Sep 18, 2026
@retrofox retrofox self-assigned this Sep 18, 2026
@github-actions

github-actions Bot commented Sep 18, 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/wordads-chart-drop-grouping branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack update/wordads-chart-drop-grouping
bin/jetpack-downloader test jetpack-mu-wpcom-plugin update/wordads-chart-drop-grouping

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 [Plugin] Wpcomsh labels Sep 18, 2026
@github-actions

github-actions Bot commented Sep 18, 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.


Wpcomsh plugin:

  • Next scheduled release: Atomic deploys happen twice daily on weekdays (p9o2xV-2EN-p2)

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.

@retrofox retrofox added [Status] Needs Review This PR is ready for review. and removed [Status] In Progress labels Sep 18, 2026
@retrofox
retrofox marked this pull request as ready for review September 18, 2026 11:43
@retrofox
retrofox requested a review from a team as a code owner September 18, 2026 11:43
@jp-launch-control

jp-launch-control Bot commented Sep 18, 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 previously approved these changes Sep 18, 2026

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

Thanks @retrofox, this tested well and code looks good! Checked each period on the local Docker site, the unit follows the window as described, the bar toggle sticks after a reload, and an instance saved on trunk with Last 30 days by weeks loads fine and draws by day.

I did leave three inline comments. The main one is around the date dropdown in the header, it's noticeably taller than the chart type toggle next to it and the other header dropdowns. The other two are small clean ups around the now unused interval control and two of the new test cases. None of them are blockers, happy if they are follow ups 🚀

withIntervalControl: true,
grain: WORDADS_GRAIN,
} ),
reportParamsAttributeField< WordAdsChartTabsAttributes >( { grain: WORDADS_GRAIN } ),

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.

The date dropdown looks quite a bit bigger than the chart type toggle next to it, and the other widget header dropdowns (like Metrics on the highlights widget above it).

Image

As far as I can tell this is because it's the page-level DatePeriodDropdown, which gets its 40px height from the menu trigger mixin ( _menu-trigger.scss ), while the header fields use size="compact" ( select-field.tsx ), so 32px. It was already like this on trunk, but it stands out more now that the toggle sits right next to it. Maybe we can scope a compact height for the widget header, similar to what date-year-filter.scss does with --wp-ui-button-height? Fine as a follow up.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch, and thanks for tracing it to the menu trigger mixin. It predates this PR and affects every widget-owned date control (the Subscribers chart in #52421 gets the same header), so I'd take it as a follow-up: the mixin hardcodes --wpds-dimension-size-lg, so it needs a compact variant the widget header can opt into rather than a local override. I'll link it here.


type ReportParamsFieldOptions = {
/**
* Whether to offer the chart bucket control.

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.

With WordAds dropping it, no widget passes withIntervalControl: true anymore, so the interval options and changeInterval in ReportParamsControl are computed for a control nobody renders. Should we remove the option, or do we expect another widget to pick it up soon? The fields README also still uses it as the example. Can be a follow up.

@retrofox retrofox Sep 18, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'd keep it. It's the widget-owned side of the same bucket control DateFiltersPanel still renders in the dashboard header (routes/dashboard/stage.tsx), and WOOA7S-2158 leaves room to bring the grouping back to this chart if people ask for weekly revenue after launch; this option is how it would come back.

The README example documents the option itself, so it still holds. The interval options are computed on every render but only read when the control renders; gating them behind the option is a two-line change if you'd prefer.

[ 'a day-long window', { from: '2026-06-29', to: '2026-06-30', interval: 'hour' }, 'day' ],
[ 'two months', { from: '2026-05-01', to: '2026-06-30', interval: 'week' }, 'day' ],
[ 'four months', { from: '2026-03-02', to: '2026-06-30', interval: 'month' }, 'week' ],
[ 'over a year', { from: '2025-05-27', to: '2026-06-30', interval: 'year' }, 'month' ],

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.

Codex pointed out that "a day-long window" and "over a year" also pass against trunk's widget code, I checked and it's right. The saved interval was never allowed for those ranges, so trunk already clamped them to the same unit. year is only on offer from 1095 days, so should we stretch this range past three years so it covers the case this PR actually changes? With the range below it fails on trunk ( requests unit=year ) and passes here.

Suggested change
[ 'over a year', { from: '2025-05-27', to: '2026-06-30', interval: 'year' }, 'month' ],
[ 'over three years', { from: '2023-01-01', to: '2026-06-30', interval: 'year' }, 'month' ],

@retrofox retrofox Sep 18, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch, confirmed: against trunk's widget code the one-year case clamps to month on its own, and so does the day-long one.

Applied your range in 4124b46: the table now keeps the three windows where trunk would honor the saved interval (two months by week, four by month, over three years by year), and all three fail against trunk's render.tsx and pass here.

The day-long window moved to its own test, since it only covers that the chart never asks for hours.

the one-year and day-long cases passed on trunk too
@retrofox
retrofox merged commit 84ec3ec into trunk Sep 18, 2026
77 checks passed
@retrofox
retrofox deleted the update/wordads-chart-drop-grouping branch September 18, 2026 20:44
@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 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Package] Premium Analytics [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Plugin] Premium Analytics [Plugin] Wpcomsh [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