Repository navigation
WOOA7S-2037: Premium Analytics: Add a plan Usage drawer to the page options menu - #52906
Closed
Nikschavan wants to merge 3 commits into
Closed
Nikschavan wants to merge 3 commits into
Nikschavan wants to merge 3 commits into
Conversation
Contributor
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
Contributor
|
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! |
Nikschavan
force-pushed
the
wooa7s-2037-page-drawer-refactor
branch
from
September 29, 2026 06:41
bb9bc5b to
36fb0f9
Compare
Nikschavan
force-pushed
the
wooa7s-2037-plan-usage-drawer
branch
from
September 29, 2026 06:41
405a20d to
2d7225d
Compare
…menu Usage opens a drawer with the current cycle's billable views against the plan limit, the over-limit warning, and an Upgrade button to the existing Stats purchase flow. It stays hidden behind the premium-analytics-usage-drawer flag until the paid plan is settled (STATS-459), and only users with manage_options see it. The plan-usage widget and the drawer now share one meter, data hook, upgrade URL and over-limit message from the toolkit, with the meter styled after the configurations design. The menu keeps one open drawer, opened from the menu or from ?usage=1, and the drawer reports its opening, Upgrade clicks and Learn more clicks to Tracks.
…lear only its param A link on the same page that adds ?usage=1 now opens the Usage drawer, since the open drawer is read from the URL on every render, with a drawer picked from the menu taking precedence. Closing a drawer removes only its own param, so closing Usage no longer drops ?settings.
…grade link LinkButton keeps the button colors in wp-admin, so the drawer's own link color override goes. The Tracks tests now count each event, across a data refresh and for keyboard activation.
Nikschavan
force-pushed
the
wooa7s-2037-page-drawer-refactor
branch
from
September 29, 2026 11:09
36fb0f9 to
10a67c8
Compare
Nikschavan
force-pushed
the
wooa7s-2037-plan-usage-drawer
branch
from
September 29, 2026 11:09
2d7225d to
fac5bfc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of WOOA7S-2037
Proposed changes
jpa/plan-usagewidget was held back on every site in Premium Analytics: hold the Plan usage widget back from Stats v2 #51834 until the paid plan is settled (STATS-459), and the configurations design (WOOA7S-2055) moves usage out of the page content into the page options menu. This adds a Usage item to that menu, which opens a drawer with the current cycle's billable views against the plan limit, the days until the cycle restarts, the over-limit warning, and an Upgrade button to the same Stats purchase flow the widget linked to.premium-analytics-usage-drawerfeature flag, off by default, so nothing changes for customers until the plan question is settled. With the flag on, only users withmanage_optionssee it, the same as Settings, since Upgrade leads to a purchase.usePlanUsage(), which keeps the VIP exception for the over-limit warning), the upgrade URL and the over-limit message, so the two cannot show different numbers. The meter follows the prototype: the figures above a thin bar in the brand color, which follows the admin color scheme, and the error color once the site is over its limit. The widget picks up the same meter, and it stays hidden.?usage=1opens Usage from a link the same way?settings=1opens Settings, and the param is removed on close.Related product discussion/links
Does this pull request change what data or activity we track or use?
Yes. It adds three Tracks events, all from the Usage drawer and all carrying only the usual Tracks user and
blog_id:jetpack_premium_analytics_usage_open, when the drawer opens, withsourceset tomenuorurl(the?usage=1link).jetpack_premium_analytics_usage_upgrade_click, when Upgrade is clicked.jetpack_premium_analytics_usage_learn_more_click, when Learn more is clicked.The events need to be registered in Tracks before they record.
Testing instructions
Use a site with this branch and the Stats v2 preview switched on: a Jurassic Ninja site with the branch synced, or the Jetpack Beta Tester plugin pointed at this branch. The site needs a Stats plan with a views limit to show the meter.
add_filter( 'jetpack_feature_flag_enabled_premium-analytics-usage-drawer', '__return_true' );in a mu-plugin, orwp companion feature-flagon Jurassic Ninja. Reload: Usage is now between Customize and Settings./wp-admin/admin.php?page=jetpack-premium-analytics-wp-admin&p=%2F%3Fusage%3D1. The drawer opens on load, and closing it removesusage=1from the URL.localStorage.debug = 'dops:analytics*'), opening the drawer and clicking Upgrade or Learn more each log their event.I tested the menu, the drawer, Upgrade, the
?usage=1link and the three events on my local site, with the flag on through a mu-plugin, and checked the events as Tracks pixel requests rather than in the debug log. I did not test the Editor step, the classic Stats comparison,wp companion, a site over its limit, or a plan without a limit; the drawer tests cover the last two.