Skip to content

Premium Analytics: Hide the Shares widget outside WPCOM Simple - #51244

Merged
chihsuan merged 1 commit into
trunkfrom
change/shares-simple-only
Aug 14, 2026
Merged

chihsuan merged 1 commit into
trunkfrom
change/shares-simple-only

Conversation

@chihsuan

@chihsuan chihsuan commented Aug 13, 2026 •

Copy link
Copy Markdown
Member

Fixes WOOA7S-1720

Proposed changes

  • Add jpa/shares to the Simple-only widget types, next to jpa/file-downloads.
  • Drop the widget from the widget picker, the REST widget-modules list, and the Insights default layout on self-hosted Jetpack and Atomic sites.
  • Leave persisted layouts untouched, so an already-saved Shares instance stays as a removable ghost widget.
  • Cover the new boundary in the availability and default-layout tests.

Share counts are recorded where the share request is processed, and that only happens on WordPress.com Simple. Everywhere else the button click is handled by the site itself and never reaches the counter, so the site summary's shares_<service> fields stay at zero however much the content is shared — the widget renders its empty state rather than erroring, which is why this went unnoticed. Calypso excludes the module on the same grounds (! isJetpackSite() in client/my-sites/stats/pages/insights/index.jsx); the port already dropped the other half of that reason by no longer calling /sites/{id}/sharing-buttons.

Related product discussion/links

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

No.

Testing instructions

Self-hosted Jetpack or another non-Simple site

  1. Build the package: jetpack build packages/premium-analytics --deps.
  2. Open the Analytics dashboard's Insights tab. Top social media shares is gone from the default layout — the comment leaderboards row now ends at Top tags & categories.
  3. Open Customize → Add widget and search for shares. It returns No results.
  4. Confirm GET /wpcom/v2/widget-modules no longer lists jpa/shares.
  5. If you have an Insights layout saved before this branch that contains Shares, confirm it is left in place and renders as Widget is no longer available. Enter Customize and remove it.

Before this branch, the widget sat in that row but only ever showed its empty state ("Learn where your content has been shared the most"): GET /rest/v1.1/sites/{id}/stats on a Jetpack-connected site returns shares, shares_x and shares_facebook, all 0.

Screenshot 2026-08-13 at 4 28 43 PM

WordPress.com Simple

  1. On a sandbox: bin/jetpack-downloader test jetpack-mu-wpcom-plugin change/shares-simple-only.

  2. Sandbox the test site and public-api.wordpress.com in /etc/hosts.

  3. Open Premium Analytics on a Simple site carrying the jetpack-premium-analytics sticker:

    wp blog-stickers add --sticker=jetpack-premium-analytics --who=<your_wpcom_login> --blog_id=<blog_id>
    
  4. Confirm Shares stays in the Insights default layout and in the widget picker.

Screenshot 2026-08-13 at 4 28 55 PM

@github-actions

github-actions Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack or WordPress.com Site Helper), and enable the change/shares-simple-only branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack change/shares-simple-only
bin/jetpack-downloader test jetpack-mu-wpcom-plugin change/shares-simple-only

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@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!

@chihsuan chihsuan changed the title WOOA7S-1720: Hide the Shares widget outside WPCOM Simple Premium Analytics: Hide the Shares widget outside WPCOM Simple Aug 13, 2026
@jp-launch-control

jp-launch-control Bot commented Aug 13, 2026 •

Copy link
Copy Markdown

Code Coverage Summary

Coverage changed in 1 file.

File Coverage Δ% Δ Uncovered
projects/packages/premium-analytics/src/widget-type-support.php 20/20 (100.00%) 0.00% 0 💚

Full summary · PHP report · JS report

@chihsuan
chihsuan marked this pull request as ready for review August 13, 2026 08:30
@chihsuan
chihsuan requested a review from a team as a code owner August 13, 2026 08:30
@chihsuan chihsuan added [Status] Needs Review This PR is ready for review. and removed [Status] In Progress labels Aug 13, 2026

@kangzj kangzj left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@chihsuan
chihsuan merged commit eac6ca0 into trunk Aug 14, 2026
89 checks passed
@chihsuan
chihsuan deleted the change/shares-simple-only branch August 14, 2026 07:01
@github-actions github-actions Bot added [Status] UI Changes Add this to PRs that change the UI so documentation can be updated. and removed [Status] In Progress [Status] Needs Review This PR is ready for review. labels Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Premium Analytics [Status] UI Changes Add this to PRs that change the UI so documentation can be updated. [Tests] Includes Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants