Skip to content

WooCommerce Stats: Stop store tracking wherever the WooCommerce tab is unavailable - #55483

Open
chihsuan wants to merge 2 commits into
wooa7s-2539-hide-the-woocommerce-stats-tab-on-self-hostedfrom
change/wooa7s-2538-disable-woo-tracking-self-hosted
Open

chihsuan wants to merge 2 commits into
wooa7s-2539-hide-the-woocommerce-stats-tab-on-self-hostedfrom
change/wooa7s-2538-disable-woo-tracking-self-hosted

Conversation

@chihsuan

@chihsuan chihsuan commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

Fixes WOOA7S-2538

Proposed changes

Stop Stats v2 from tracking shoppers on stores where the WooCommerce tab is hidden, so we never collect store data the owner cannot see. By default that is every store not hosted on WordPress.com, where wpcomsh turns the tab on (#55498).

  • With the Jetpack WooCommerce Analytics module on, the store keeps the tracking it had before Stats v2. Only the ClickHouse and session tracking Stats v2 adds stop.
  • Without the Jetpack plugin (Jetpack Stats or Premium Analytics alone), the store tracker no longer starts.
  • Tracking follows the same switch as the tab, the jetpack-woocommerce-stats feature flag. The store tracking filter can no longer turn it on while the flag is off.

WordPress.com stores are unchanged.

Related product discussion/links

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

Yes, it tracks less. On self-hosted stores Stats v2 no longer sends ClickHouse or session events. The Jetpack WooCommerce Analytics module still sends the events it sent before Stats v2. No new data is collected.

Testing instructions

Setup: a self-hosted, Jetpack-connected site with WooCommerce active, the WooCommerce Analytics module on, and Stats v2 turned on. Build Jetpack from this branch.

Jetpack store

  1. Open the store's home page and its source.
  2. Confirm window.wcAnalytics.features.ch and sessionTracking are false (both are true on trunk), and window._wca is still set.

Without the Jetpack plugin

  1. Deactivate Jetpack and activate the Jetpack Stats plugin built from this branch, with Stats v2 turned on.
  2. Reload the home page. Confirm there is no window._wca and no wcAnalytics script (both are there on trunk).

Filters, on the same site

  1. Add an MU-plugin with add_filter( 'jetpack_woocommerce_stats_store_tracking_enabled', '__return_true', 99 ); and reload. Confirm there is still no window._wca. Remove the MU-plugin.
  2. Add an MU-plugin with add_filter( 'jetpack_feature_flag_enabled_jetpack-woocommerce-stats', '__return_true' ); and reload. Confirm window._wca is back and features.ch is true. Remove the MU-plugin.

WordPress.com Atomic

  1. On an Atomic store with Stats v2 on and WooCommerce Stats: Turn the feature flag on for Atomic sites #55498 deployed, open the home page. Confirm features.ch is true, as on trunk.

@github-actions

github-actions Bot commented Nov 26, 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), and enable the change/wooa7s-2538-disable-woo-tracking-self-hosted branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack change/wooa7s-2538-disable-woo-tracking-self-hosted

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

github-actions Bot commented Nov 26, 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!


Jetpack plugin:

The Jetpack plugin has different release cadences depending on the platform:

  • WordPress.com Simple releases happen as soon as you deploy your changes after merging this PR (PCYsg-Jjm-p2).
  • WoA releases happen weekly.
  • Releases to self-hosted sites happen monthly:
    • Scheduled release: December 8, 2026
    • Code freeze: December 7, 2026

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.

@chihsuan
chihsuan marked this pull request as ready for review November 26, 2026 04:53
@chihsuan chihsuan added [Status] Needs Review This PR is ready for review. and removed [Status] In Progress labels Nov 26, 2026
@chihsuan
chihsuan requested a review from a team November 26, 2026 04:53
@jp-launch-control

jp-launch-control Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Code Coverage Summary

No summary data is available for parent commit c8b30cb, so cannot calculate coverage changes. 😴

If that commit is a feature branch rather than a trunk commit, this is expected. Otherwise, this should be updated once coverage for c8b30cb is available.

Full summary · PHP report · JS report

@chihsuan
chihsuan marked this pull request as draft November 26, 2026 06:16
@chihsuan
chihsuan force-pushed the change/wooa7s-2538-disable-woo-tracking-self-hosted branch from fed3a35 to 3c47a83 Compare November 27, 2026 03:10
…ed' into change/wooa7s-2538-disable-woo-tracking-self-hosted

# Conflicts:
#	projects/packages/woocommerce-stats/README.md
#	projects/packages/woocommerce-stats/src/class-woocommerce-analytics-tracker.php

@dognose24 dognose24 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.

Looks good! I spun up a couple of JN stores to check. Tracking is on with trunk and off with this branch, so it does what it says.

Also checked the requests in the browser. No w.gif and no session events on this branch, and cart_view still goes out on t.gif.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Docs [Package] Woocommerce Stats [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Plugin] Premium Analytics [Status] Needs Review This PR is ready for review. [Tests] Includes Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants