Skip to content

Tracks: preview site events (STU-2119) - #4482

Open
wojtekn wants to merge 2 commits into
trunkfrom
stu-2119-tracks-preview-site-events
Open

Tracks: preview site events (STU-2119)#4482
wojtekn wants to merge 2 commits into
trunkfrom
stu-2119-tracks-preview-site-events

Conversation

@wojtekn

@wojtekn wojtekn commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Related issues

How AI was used in this PR

Claude Code explored the existing Tracks patterns (the sibling STU-2115/STU-2116 work), drafted and verified the plan, and implemented the events, tests, and docs. I reviewed the emitter loci, the CLI-vs-renderer split, and the delete-all decision, and verified the emit paths myself (unit tests + a CLI smoke test confirming channel attribution).

Proposed Changes

Preview-site sharing (WordPress.com hosted previews) had no analytics, so we couldn't tell how many users share their work via preview links, or how reliable create/update is in the field. This adds Tracks events across the preview-site lifecycle:

  • studio_preview_site_create / studio_preview_site_update — with success, failure_reason, and time_ms, so we get both adoption and a success/latency funnel.
  • studio_preview_site_delete — a single preview deleted.
  • studio_preview_site_delete_all — the "delete all" action, carrying a count of previews removed.
  • studio_preview_site_open — a user opening a preview URL to visit it.

Create/update/delete/delete-all all fire from the CLI, which is the sole funnel: the desktop Previews tab delegates every one of these actions to the app-spawned CLI, so each action is counted exactly once whether it originated in the UI or standalone, and is attributed to the right surface via channel/ui_version. open has no CLI equivalent and fires from the renderer. No PII is ever sent — no site names, paths, or URLs; failure_reason is a coarse, low-cardinality bucket and the raw error is never included.

Testing Instructions

  1. Start Studio npm start
  2. Open a site's Previews tab.
  3. Create, Update, Delete, and Delete-all a preview site; confirm the console logs Would have recorded Tracks event: studio_preview_site_* with channel: studio-ui and the correct ui_version, and that each action logs exactly once.
  4. Click a preview's URL and confirm studio_preview_site_open logs.
  5. Confirm CLI paths: studio preview create/update/delete [--all] log the same events with channel: studio-cli.

Follow-up (issue DoD, not code)

Each event and all its eventprops (including the wrapper-attached common props) still need registering via the Tracks Registration tool — documentation/CI integrity, separate from ingestion.

Pre-merge Checklist

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

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@wojtekn
wojtekn requested a review from a team August 7, 2026 15:16
@wpmobilebot

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing 06737ca vs trunk

app-size

Metric trunk 06737ca Diff Change
App Size (Mac) 1405.26 MB 1405.27 MB +0.00 MB ⚪ 0.0%

site-editor

Metric trunk 06737ca Diff Change
load 1072 ms 1043 ms 29 ms ⚪ 0.0%

site-startup

Metric trunk 06737ca Diff Change
siteCreation 7532 ms 7555 ms +23 ms ⚪ 0.0%
siteStartup 2865 ms 2868 ms +3 ms ⚪ 0.0%

Results are median values from multiple test runs.

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

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.

2 participants