Skip to content

Keep Ceros analytics off in SSR Store mode - #52

Merged
KarolNov merged 2 commits into
mainfrom
claude/no-analytics-in-store-mode
Oct 16, 2026
Merged

KarolNov merged 2 commits into
mainfrom
claude/no-analytics-in-store-mode

Conversation

@KarolNov

Copy link
Copy Markdown
Contributor

Why

Follow-up to #41, from the review thread. Store mode stores the experience but not the analytics script. Ceros analytics events aren't versioned, so a stored runtime that falls behind could report events the pipeline no longer reads. Storing the script as well wouldn't fix that, and Ceros exports have never carried analytics, because customers who host a copy don't want to depend on Ceros. We agreed to turn analytics off in Store mode for now.

What

  • Store mode never reports. ceros_flex_tracking_enabled() returns false when the block is in Store mode (ceros_flex_is_store_mode(): SSR delivery with a storedIndexPath). Every delivery path writes data-ceros-analytics="disabled", including the fallbacks used when the stored copy can't be read. A stored copy left behind after switching to Inline or iframe doesn't count, because render.php only reads it for SSR.
  • The sidebar shows the switch off and disabled in Store mode, with help text saying why. The saved cerosAnalytics value isn't changed, so the author's choice comes back when they remove the stored copy. isStoreMode() in constants.js mirrors the PHP rule.

Testing

  • PHPUnit: 352 pass. New cases cover Store mode with the toggle unset, on and off, plus what counts as Store mode, including a stored copy left after switching delivery mode. PHPCS is clean.
  • JS: 135 pass, including isStoreMode(). Lint and build are clean.
  • E2E: analytics-tracking.spec.ts gains a Store-mode case: switch on, stored copy unreadable, renders disabled. It passes against wp-env and fails with the rule removed.
  • In the editor on wp-env, a Store-mode block shows the switch off and disabled with the saved value still true. Removing the stored copy turns it back on.

Not verified

  • A real stored copy rendering. The e2e case uses a stored copy that isn't on disk, so it covers the decision and the fallback, not ceros_render_flex_ssr_stored() itself. That path takes the same $tracking.

🤖 Generated with Claude Code

A stored copy doesn't include the reporting bundle, and Ceros analytics
events aren't versioned, so a stored runtime that falls behind could report
events the pipeline no longer reads. Store mode is for a page that doesn't
depend on Ceros, so it now reports nothing.

- ceros_flex_tracking_enabled() returns false in Store mode (SSR delivery
  with a stored copy), including when the stored copy can't be read and the
  block falls back. A stored copy left behind after switching to another
  delivery mode doesn't count.
- The sidebar shows the switch off and disabled in Store mode, without
  changing the saved choice, which comes back when the stored copy is
  removed.
- Unit, JS and e2e coverage for the rule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

✅ WordPress Plugin Check Report

✅ Status: Passed

📊 Report

All checks passed! No errors or warnings found.


🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@KarolNov
KarolNov marked this pull request as ready for review October 16, 2026 16:04
@KarolNov
KarolNov merged commit e9e6b57 into main Oct 16, 2026
11 checks passed
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