Repository navigation
Conversation
…he date picker stats/tags takes a date window now (wpcom #245720), so the widget and its report read the dashboard period: date and start_date on the request, summarize past a month. The widget moves from the Insights default layout to the Traffic one, its copy stops naming seven days, and the CSV export names the window. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
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! 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. Wpcomsh plugin:
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. |
Code Coverage SummaryCoverage changed in 3 files.
|
A customized layout does not follow the default, so the first section layout migration rewrites the stored map: Tags leaves a customized Insights and joins a customized Traffic, recorded by id so a tile the reader removes afterwards stays removed. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
chihsuan
left a comment
There was a problem hiding this comment.
Nice work on moving Tags onto the date picker! @dognose24 I left a few inline notes.
Have we confirmed with Gary how saved layouts should handle the move? I wonder if we should move Tags automatically, or only add it to Traffic and leave the existing one on Insights.
| * instead of day by day, which keeps a long window to a few queries. | ||
| */ | ||
| export type StatsTagsParams = { | ||
| const SUMMARIZE_MIN_DAYS = 31; |
There was a problem hiding this comment.
Could we double-check how the numbers line up across the 31-day switch? I noticed the summarized path in wpcom PR 245720 keeps the top 50 posts for the whole window, while the per-day path keeps 50 per day. So Last 90 days can show fewer tags and views than Last 30 days.
There was a problem hiding this comment.
You're right, and it is not a rounding difference: the per-day path keeps 50 posts for each day table, the summarized path keeps 50 for the whole window after the post_type filter, so a 30-day range could count a few hundred posts and a 90-day range only 50. Views fall as the window grows.
Fixed in 802a935 by dropping the 31-day switch: stats/tags now gets summarize=1 at every length, so every range reads the same way, the window's top 50 posts by tag. It is also cheaper, one UNION per partition instead of one query per day. The endpoint accepts summarize=1 for any length, nothing to change on the WordPress.com side.
The trade-off is deliberate: a 7-day range no longer matches the per-day ranking classic Stats reads, and Premium Analytics does not need to.
| 1, | ||
| 2 | ||
| ), | ||
| // Row 6: tags & categories, ranked over the tab's period. |
There was a problem hiding this comment.
Should tags.dashboardSection in routes/reports/registry.ts move to 'traffic' too? It still says 'insights', so the Tags report is gated on the Insights tab being available.
There was a problem hiding this comment.
Good catch, it was still gated on Insights. Moved to traffic in 29a3858, with the registry test's tab map updated.
| /** | ||
| * `stats/tags` has no "all rows" value (see `StatsTagsParams`), so the report names a ceiling | ||
| * past what a real site produces (the endpoint ranks at most ~51 posts a day over seven days). | ||
| * past what a real site produces (the endpoint ranks at most ~50 posts a day). |
There was a problem hiding this comment.
nit: Would it be worth dropping the per-day math here? With a window up to a year it no longer explains the 1000, and processing/stats/tags.ts still says the endpoint "takes only max".
| * past what a real site produces (the endpoint ranks at most ~50 posts a day). | |
| * past what a real site produces. |
There was a problem hiding this comment.
Dropped the per-day math, and reworded the note in processing/stats/tags.ts that still said the endpoint takes only max. Same commit.
| /** | ||
| * | ||
| * @param key | ||
| */ |
There was a problem hiding this comment.
nit: Could we drop this leftover stub?
| /** | |
| * | |
| * @param key | |
| */ |
…es and a leftover stub Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Per-day ranking keeps 50 posts a day and the summarized pass keeps 50 for the whole window, so switching between them at a month let a longer range count fewer posts than a shorter one. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…s-tags-widget-traffic # Conflicts: # projects/packages/premium-analytics/routes/reports/tags/page.tsx
… follow-up Whether a reader who customized Insights should have Tags moved for them, or only added on Traffic, is a product call still open on the review. The mechanism ships separately once it is made. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
Good question, and not one I should settle in this PR. I pulled the migration out: 7ee6ece leaves stored layouts alone, so a reader who customized Insights keeps the Tags tile there (on the Insights year picker now) and one who customized Traffic does not gain it. The move-it-once mechanism is parked as a draft in #53381, stacked on this one, and the call between moving it and only adding it on Traffic is WOOA7S-2291 for the product side. |
Fixes WOOA7S-2236
Blocked on the WordPress.com half, WOOA7S-2235 (wpcom PR 245720), which lets
stats/tagstake a date window. Until that is merged and deployed, WordPress.com strips every date parameter from the request and the widget keeps showing the seven days ending yesterday whatever the picker says. This PR stays a draft until then.Why
Top tags & categories sat on the Insights tab as a fixed last-7-days list, because the endpoint behind it ignored every date parameter. Product asked on the soft-launch thread for it to sit on Traffic and follow the date picker like the other list widgets.
Proposed changes
statsTagsQuerytakes the report params like the other Stats list queries and sendsdateandstart_date, from which the endpoint sizes its window. It sendssummarize=1at every length, so the endpoint ranks the window's top posts in one pass: the per-day path keeps 50 posts a day while one pass keeps 50 for the window, so switching between them by length would let a longer range count fewer posts than a shorter one. A 7-day range therefore no longer matches the per-day ranking classic Stats reads, which is deliberate.daysstays off the request.reportParamsfromWidgetRootand hands the window touseStatsTags(). It opts out of the comparison, sincestats/tagsreports one period.get_insights_section_default_layout()toget_traffic_section_default_layout(), as a new row after File downloads. Row placement is a provisional pick, not a design call; the remaining Insights rows keep their widths and close up by one order.widget.json: the title drops "in the last 7 days" (the picker names the period now); the description and help say what the number is, a breakdown of the most viewed posts by their current tags and categories, not a filter over all traffic.trafficsection too, so the report is gated on the Traffic tab rather than Insights.summarizeat every length; the widget's request carries the window and refetches when the period changes; the report hook passes the window; the default layout tests follow the move; the CSV parity case for Tags moves to the dated set.Related product discussion/links
Does this pull request change what data or activity we track or use?
No.
Testing instructions
Needs a site whose WordPress.com side carries wpcom PR 245720 (a sandbox with that branch, or after it deploys).
stats/tagsrequest carriesdateandstart_datefor it. Whatever the range, the request also carriessummarize=1.jp test js packages/premium-analyticsandjp test php packages/premium-analyticspass.🤖 Generated with Claude Code