Skip to content

Disable Jetpack Stats for local sites#4035

Open
shaunandrews wants to merge 4 commits into
trunkfrom
stu-1945-disable-jetpack-stats
Open

Disable Jetpack Stats for local sites#4035
shaunandrews wants to merge 4 commits into
trunkfrom
stu-1945-disable-jetpack-stats

Conversation

@shaunandrews

Copy link
Copy Markdown
Contributor

Related issues

How AI was used in this PR

Codex investigated the localhost Stats repro, confirmed that local Studio-rendered pages can emit Jetpack Stats pixels with live blog IDs, and prepared this scoped fix. I reviewed the generated change and kept the PR limited to the Studio MU plugin behavior plus a regression test.

Proposed Changes

  • Prevent Studio-served local sites from reporting page views to the remote WordPress.com/Jetpack Stats site when an imported or synced local database still contains a live Jetpack connection.
  • Preserve the existing local-development behavior that disables Jetpack Protect for auto-login, while also disabling Jetpack Stats through the same module filter path.
  • Keep the fix server-side in the local WordPress runtime so it applies to Studio previews, thumbnail captures, and local sites opened in an external browser.

Testing Instructions

  • npx eslint --fix tools/common/lib/mu-plugins.ts tools/common/lib/tests/mu-plugins.test.ts
  • npm test -- tools/common/lib/tests/mu-plugins.test.ts
  • npm run typecheck

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

@shaunandrews shaunandrews changed the title [codex] Disable Jetpack Stats for local sites Disable Jetpack Stats for local sites Jul 1, 2026
@sejas sejas marked this pull request as ready for review July 10, 2026 13:51
@wpmobilebot

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing 763cd63 vs trunk

app-size

Metric trunk 763cd63 Diff Change
App Size (Mac) 1419.35 MB 1419.36 MB +0.00 MB ⚪ 0.0%

site-editor

Metric trunk 763cd63 Diff Change
load 1080 ms 1121 ms +41 ms ⚪ 0.0%

site-startup

Metric trunk 763cd63 Diff Change
siteCreation 6492 ms 6524 ms +32 ms ⚪ 0.0%
siteStartup 2392 ms 2397 ms +5 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

@sejas

sejas commented Jul 10, 2026

Copy link
Copy Markdown
Member

@shaunandrews I thought about implementing this same solution when I found you (and your agents) already created the PR. 💫

@sejas sejas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The code looks good to me, but I'm still seeing the pixel and the stats module active. I'll investigate more next week. Happy to take over this PR.

Image Image

@shaunandrews

Copy link
Copy Markdown
Contributor Author

Please do!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants