Skip to content

Stats v2: rename Premium Analytics menu and stop replacing legacy Stats - #50915

Open
kangzj wants to merge 5 commits into
trunkfrom
rename/premium-analytics-stats-v2
Open

Stats v2: rename Premium Analytics menu and stop replacing legacy Stats#50915
kangzj wants to merge 5 commits into
trunkfrom
rename/premium-analytics-stats-v2

Conversation

@kangzj

@kangzj kangzj commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Why this matters

The bundled analytics dashboard currently shows as "Premium Analytics" (WPCOM Simple) or the generic "Analytics" (Atomic and other flag-enabled sites), and it swaps out the existing Stats menu entirely the moment it's enabled — no way back to the surface people are used to mid-rollout. This renames the dashboard to "Stats v2" and adds it as a second menu alongside the existing Stats menu, on every site, instead of replacing it.

Fixes #

Proposed changes

  • Rename the bundled dashboard's admin menu label from "Premium Analytics" (WPCOM Simple bootstrap, Premium Analytics: Wire Simple bootstrap behind gate #50266) / "Analytics" (default label, used by Atomic via Premium Analytics: enable on Atomic sites with the blog sticker #50834 and any other flag-enabled site) to "Stats v2". It already registers as its own separate top-level menu item — that didn't need to change.
  • Stop suppressing the legacy Stats menu, admin-bar entries, post-list column, and dashboard widget when Stats v2 is enabled — the two now coexist everywhere, regardless of host.
  • Update the affected unit tests and the stale doc comments describing the old unconditional "replace" behavior.

Related product discussion/links

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

Testing instructions

  • On a site with the jetpack_premium_analytics_enabled flag on (or the WPCOM Simple / Atomic rollout gates), confirm both "Stats" and "Stats v2" appear as separate top-level admin menu items, and that the Stats admin-bar entry, post-list column, and WP dashboard widget are still present.
  • jp docker phpunit jetpack --php 8.3 -- --filter "Jetpack_Premium_Analytics_Test|Stats_Admin_Bar_Test" — 15/15 pass.
  • jp test php packages/jetpack-mu-wpcom and the Analytics_Test label assertions in packages/premium-analytics — pass.

Renames the bundled dashboard's admin menu label from "Premium Analytics"
(WPCOM Simple) / "Analytics" (default, used by Atomic and other flag-enabled
sites) to "Stats v2", and removes the code that suppressed the legacy Stats
menu, admin-bar entries, post-list column, and dashboard widget whenever the
flag was on. Stats v2 now adds its own menu alongside the existing Stats UI
instead of replacing it, matching how WPCOM Simple already behaved.
@kangzj
kangzj requested review from a team as code owners July 30, 2026 02:48
@kangzj kangzj added the [Status] Needs Review This PR is ready for review. label Jul 30, 2026
@kangzj kangzj self-assigned this Jul 30, 2026
@github-actions github-actions Bot added [Package] Jetpack mu wpcom WordPress.com Features [Package] Premium Analytics [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Tests] Includes Tests labels Jul 30, 2026
@github-actions

github-actions Bot commented Jul 30, 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:

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.

@github-actions

github-actions Bot commented Jul 30, 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 rename/premium-analytics-stats-v2 branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack rename/premium-analytics-stats-v2
bin/jetpack-downloader test jetpack-mu-wpcom-plugin rename/premium-analytics-stats-v2

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

@jp-launch-control

jp-launch-control Bot commented Jul 30, 2026

Copy link
Copy Markdown

Code Coverage Summary

Coverage changed in 2 files.

File Coverage Δ% Δ Uncovered
projects/plugins/jetpack/modules/stats.php 22/551 (3.99%) -0.35% 0 💚
projects/plugins/jetpack/class-jetpack-stats-dashboard-widget.php 0/125 (0.00%) 0.00% -2 💚

Full summary · PHP report · JS report

@kangzj
kangzj marked this pull request as draft July 30, 2026 03:02
kangzj added 2 commits July 30, 2026 15:33
Narrows scope back to the label rename. The legacy Stats menu, admin-bar
entries, post-list column, and dashboard widget keep being suppressed by
the existing jetpack_premium_analytics_enabled gate exactly as before —
that gate and the "replace" behavior it drives are untouched. Stats v2
already registers its own separate top-level menu unconditionally when
enabled; nothing about that needed to change.
Scopes the existing jetpack_premium_analytics_enabled replace behavior to
exclude Atomic sites (Automattic\Jetpack\Status\Host::is_woa_site()). On
Atomic the legacy Stats menu, admin-bar entries, post-list column, and
dashboard widget now stay in place alongside the new Stats v2 menu instead
of being suppressed. Self-hosted and other WPCOM flag-enabled sites keep
the existing replace behavior unchanged.
@kangzj

This comment has been minimized.

@claude

This comment has been minimized.

kangzj added 2 commits July 30, 2026 16:29
Broadens the previous Atomic-only exception to every site: Stats v2 always
adds its own admin menu alongside the existing Stats menu, admin-bar
entries, post-list column, and dashboard widget instead of replacing them,
regardless of host. Drops the now-unused Host::is_woa_site() check from
modules/stats.php and class-jetpack-stats-dashboard-widget.php.
Retype the plugins/jetpack changelog entry as enhancement instead of
bugfix — this is an intentional rollout behavior change, not a defect
fix. Document why test_stats_admin_menu_kept_when_enabled() only tears
down the one action it asserts on.
@kangzj

This comment has been minimized.

@kangzj

This comment has been minimized.

@claude

This comment has been minimized.

@kangzj

kangzj commented Jul 30, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Review-cycle summary — 0a3fc094a5b17bf0b4a3

3 round(s); CI green; 1 AI reviewer round-trip addressed (no threads to resolve — no inline comments were left).

What changed during the cycle

Commits added:

  • b17bf0b4a3 — Address review: changelog type + test hygiene note (comment #5126405852)
  • f5223dec56 — Stats v2: never replace the legacy Stats menu, on any site

Diff summary: 6 files changed, 35 insertions(+), 146 deletions(-)

Review threads addressed:

Source Comment Resolution
claude[bot] (#5126405852) 3 non-blocking notes: duplicated replace-predicate across files, stats_load() test hygiene, changelog type bugfix vs enhancement Predicate concern resolved outright by f5223dec56 (the replace logic was deleted entirely, not centralized); added a hygiene doc-comment to the test and retyped the changelog to enhancement in b17bf0b4a3
claude[bot] (#5126523064) re-review — verified all three items, no blocking issues, one non-blocking observation (the per-request cache on is_premium_analytics_enabled() is now less load-bearing with fewer callers) No action needed — reviewer explicitly noted nothing to change

Unaddressed (flagged for owner):
None.

CI: all required checks passing (36 pass, 8 skipping as expected for unaffected file types).

@kangzj kangzj added [Status] Needs Team Review Obsolete. Use Needs Review instead. and removed [Status] In Progress labels Jul 30, 2026
@kangzj
kangzj marked this pull request as ready for review July 30, 2026 04:54
@kangzj kangzj removed the [Status] Needs Review This PR is ready for review. label Jul 30, 2026

@chihsuan chihsuan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @kangzj LGTM! 🚢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Jetpack mu wpcom WordPress.com Features [Package] Premium Analytics [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Status] In Progress [Status] Needs Team Review Obsolete. Use Needs Review instead. [Tests] Includes Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants