Repository navigation
Stats abilities: limit new free sites to the last 30 days behind a start-date switch - #55591
Merged
Merged
Conversation
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! |
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?
|
Code Coverage SummaryCoverage changed in 1 file.
1 file is newly checked for coverage.
|
chubes4
marked this pull request as ready for review
November 30, 2026 16:14
…art-date switch Plan_Window decides the days a site's plan covers: free sites created on or after the jetpack_stats_plan_window_start day see the last 30 days; older sites, paid plans and unknown plans keep full history. The filter returns null by default, so nothing changes until a start day is set. Windowed abilities refuse a window that starts earlier with jetpack_stats_requires_plan, and get-top-content returns the same code when WordPress.com refuses a type the plan lacks.
chubes4
force-pushed
the
update/stats-abilities-plan-limits
branch
from
November 30, 2026 21:40
6cc651d to
06a361d
Compare
chubes4
force-pushed
the
update/stats-abilities-plan-limits
branch
from
November 30, 2026 22:25
06a361d to
327af9e
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 the Stats MCP plan limits work (UNI-1081).
Proposed changes
The new pricing gives free sites created after launch the last 30 days of Stats. Existing sites and paid plans keep full history. This adds that rule to the Stats abilities, switched off until a launch day is set.
Plan_Window(new, Stats package) decides how many days of Stats a site's plan covers.jetpack_stats_plan_window_startday get 30 days.stats-paidorstats-commercial, and sites whose plan data hasn't synced (so a paying site is never limited because data is missing).nullby default, so nothing changes until a start day is set.get-visits(comparison window included),get-top-content(dated types),get-post-views,get-author-views,get-video-stats,get-followers(withperiod) andget-ad-statsrefuse a window that starts before the plan's first day. They returnjetpack_stats_requires_planwithfeature: historyandearliest_date.get-top-contentnow returnsjetpack_stats_requires_plannaming the type, instead of passing the rawstats_errorthrough.Not limited here: all-time figures (a post's total views, insights,
get-email-statswithout a start date, the per-post email detail), and history download, which pricing keeps open on every plan. Questions about these go on UNI-1081.Other information:
Jetpack product discussion
Linear: UNI-1081, project Jetpack Stats Exit Ramps. Pricing: unifiedanalyticsp2 "New pricing for Jetpack Stats and WooCommerce Stats".
Does this pull request change what data or activity we track or use?
No.
Testing instructions
Primary evidence: a sandbox run through the real WordPress.com MCP JSON-RPC (
tools/call→execute), with this branch's Stats package patched intojetpack-mu-wpcom-pluginand the filter driven by an environment variable.This site's plan covers the last 30 days of Stats, from 2026-11-02.This site's plan does not include regions stats.Cost of
Plan_Window::get_days(): about 1 µs per call with the switch off, and about 85 µs with it on (one blog lookup and one feature check).To try it locally:
add_filter( 'jetpack_stats_plan_window_start', fn() => '2026-01-01' );on a free site created after that day.jetpack-stats/get-visitswithnum: 31. It returnsjetpack_stats_requires_plan; withnum: 30it returns data.composer phpunit -- --filter 'plan_window|plan_lacks'inprojects/packages/stats. The refused cases fail on trunk.Written with Claude (Anthropic) via Pi: code, tests and the sandbox verification. Chris Huber directed.