Skip to content

WOOA7S-1500: Port Stats Tags & categories widget#50147

Draft
kangzj wants to merge 3 commits into
trunkfrom
add/wooa7s-1500-tags-categories
Draft

WOOA7S-1500: Port Stats Tags & categories widget#50147
kangzj wants to merge 3 commits into
trunkfrom
add/wooa7s-1500-tags-categories

Conversation

@kangzj

@kangzj kangzj commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Fixes WOOA7S-1500

Proposed changes

  • Port the Jetpack Stats "Tags and categories" module into a registered Premium Analytics dashboard widget (jpa/tags-categories).
  • Renders the most viewed tags and categories for the selected period as a leaderboard, sourced from useStatsTags in @jetpack-premium-analytics/data.
  • Single tags/categories link to their archive; grouped rows (several tags/categories combined on one post) render as plain text since they have no single archive URL.
  • Honors the Stats-widget contract: max = 0 shows all rows, loading overlay only when there is no data yet, counts formatted with multipliers, and the widget renders body only (host owns the chrome).
  • The Stats tags endpoint has no comparison period, so the widget renders single-period values only; the WithComparison story documents that the module has no comparison data to display.
  • Adds the required Storybook stories (Default, WithComparison, WidgetDashboardWithWidget) and a changelog entry.

Related product discussion/links

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

No. It reuses the existing Stats tags proxy endpoint via the shared data hook; no new tracking.

Testing instructions

  • Run Storybook for the Premium Analytics package and open Packages/Premium Analytics/Widgets/TagsCategories.
  • Verify the Default, WithComparison, and WidgetDashboardWithWidget stories render the leaderboard; confirm rows with a link are clickable and grouped rows render as plain text.
  • pnpm exec eslint projects/packages/premium-analytics/widgets/tags-categories — clean.
  • jetpack build packages/premium-analytics (with dependencies built) — succeeds.
  • Live-dashboard verification (skill step 9) pending — handled centrally by orchestrator; Storybook + audit + eslint pass locally.

Port the Jetpack Stats "Tags and categories" module into a registered
Premium Analytics dashboard widget. Renders the most viewed tags and
categories for the selected period as a leaderboard sourced from
useStatsTags; single tags/categories link to their archive while grouped
rows render as plain text. The Stats tags endpoint has no comparison
period, so the widget renders single-period values only.
@github-actions

github-actions Bot commented Jul 2, 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!

@github-actions github-actions Bot added [Package] Premium Analytics [Status] In Progress [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. labels Jul 2, 2026
@jp-launch-control

jp-launch-control Bot commented Jul 2, 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

Add a widget-scoped apiFetch middleware that serves a realistic raw
stats/tags response so the Default, WithComparison, and
WidgetDashboardWithWidget stories render a populated leaderboard instead
of the empty state. Include a grouped (multi-tag) row so the plain-text
path is exercised alongside linked rows.

Wrap the widget body in a styles.root element so the picker-preview
aspect-ratio rule has an element to attach to.
@kangzj

kangzj commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

Live dashboard verification — Tags & categories

Rendered on the connected Premium Analytics dashboard (Insights tab, raven env, blog 254382195) with real data and zero console errors.

Tags & categories

@kangzj kangzj marked this pull request as ready for review July 2, 2026 07:32
@kangzj kangzj requested review from a team as code owners July 2, 2026 07:32
@kangzj kangzj marked this pull request as draft July 2, 2026 07:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Premium Analytics [Status] In Progress [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant