Skip to content

WOOA7S-1497: add Videos widget backed by Jetpack Stats#49573

Draft
Nikschavan wants to merge 9 commits into
update/pa-introduce-customize-dashboardfrom
wooa7s-1497-port-jetpack-stats-module-videos
Draft

WOOA7S-1497: add Videos widget backed by Jetpack Stats#49573
Nikschavan wants to merge 9 commits into
update/pa-introduce-customize-dashboardfrom
wooa7s-1497-port-jetpack-stats-module-videos

Conversation

@Nikschavan

Copy link
Copy Markdown
Member

Proposed changes

Ports the Videos widget from the Jetpack Stats module into the Premium Analytics dashboard, backed by the Jetpack Stats API.

  • data package: adds a stats-fetch API client that goes through the stats-admin proxy (/jetpack/v4/stats-app/sites/{blog_id}/stats/{resource}), plus statsQuery/statsVideoPlaysQuery query builders and useStatsVideoPlays/useStatsBlogId hooks. The blog ID is resolved once from /jetpack/v4/connection/data and cached for the page lifetime; queries use skipToken while the blog ID or report date is unresolved.
  • widgets-toolkit: adds VideosWidget (leaderboard chart of most played videos with comparison support) and a buildVideoPlaysData helper, with loading/refetching overlays and empty/error states.
  • premium-analytics plugin: registers the jpa/videos dashboard widget (render entry, widget.json, widget.ts with a configurable max attribute). The render entry defaults to an all-time report range until the host can pass the site launch date.
  • chart empty state: centers the empty state across the full widget width instead of the chart column.
  • query client provider: adds a withDevtools prop so React Query devtools render once at the page level instead of per widget.
  • icons: adds a video icon used for the chart empty state.

Note: the diff also carries the "add dynamic widget registry and REST endpoint" commit until the base branch catches up with it.

Related product discussion/links

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

No.

Testing instructions

  • Set up a Jetpack-connected site with the Premium Analytics plugin active, ideally one with VideoPress/video traffic.
  • Go to the Premium Analytics dashboard and open the widget picker.
  • Add the Videos widget.
  • Verify it renders a leaderboard of the most played videos, sourced from Jetpack Stats (check the network tab for requests to /jetpack/v4/stats-app/sites/{blog_id}/stats/video-plays).
  • Change the Maximum videos attribute and verify the list respects the limit.
  • On a site with no video plays, verify the empty state copy renders centered across the widget instead of the chart.

retrofox and others added 9 commits June 12, 2026 07:47
Private, source-consumed copy of @wordpress/grid until core publishes it.
Private, source-consumed copy of @wordpress/widget-primitives until core publishes it.
Private, source-consumed dashboard engine; depends on jetpack-widget-primitives and jetpack-grid.
Renders the WidgetDashboard engine via wp-build, bundling the grid/primitives/dashboard packages.
useWidgetTypes drives discovery via /wp/v2/widget-modules; hello-world builds as a lazy-loaded script module.
Hook the page boot-dependencies filter so widget modules reach the import map; move the endpoint to the jetpack/v4 namespace.
@wordpress/grid and widget-primitives references in widget-dashboard JSDoc/comments/README, per the faithful-source sync policy.
Adds a Videos dashboard widget showing most played videos via the stats-admin REST proxy, with a shared stats query in the data package. Also centers chart empty states across the full widget width and renders React Query devtools once at the page level instead of per widget.
@github-actions

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 the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label Jun 12, 2026
@nerrad nerrad force-pushed the update/pa-introduce-customize-dashboard branch from d060b2d to 5bb6dd9 Compare June 12, 2026 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants