Skip to content

fix(analytics): preserve attribution and relay embedded Brain events - #359

Merged
zjy365 merged 1 commit into
mainfrom
codex/fix-brain-analytics-continuity
Oct 12, 2026
Merged

zjy365 merged 1 commit into
mainfrom
codex/fix-brain-analytics-continuity

Conversation

@zjy365

@zjy365 zjy365 commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

Embedded Brain activity stops following the Desktop user after module_open: child-frame events use an independent analytics context, and both entry redirects discard sea_attr and consent_token.

Preserve the two marketing parameters across / and /deploy redirects and capture them during SDK bootstrap. Queue early embedded events until Desktop reports its optional features.analytics capability, then relay custom events through the existing runEvents("trackAnalyticsEvent", payload) API. Standalone Brain and older Desktop deployments retain the existing GTM transport. Once Desktop owns delivery, acknowledgement failures do not also send through iframe GTM.

The companion Desktop change supplies the canonical UUID and attribution through the parent analytics context. Deploy Desktop first for immediate continuity; this PR can still merge independently because capability negotiation preserves the older-host behavior. No SDK package update, database migration, or GTM publication is required for the embedded flow.

Validation:

  • bun check and bun typecheck from the repository root.
  • 33 focused tests passed across analytics transport/events, marketing attribution/redirects, template/GitHub links, and SDK hydration (bun test from apps/ui).
  • Tests cover startup buffering, one-time relay, old-host fallback, standalone delivery, lost acknowledgements, UTF-safe parameter preservation, and credential exclusion.

Companion Desktop PR: labring/sealos#7356.

@zjy365
zjy365 merged commit 0cf51be into main Oct 12, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant