Repository navigation
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
After Desktop emits
module_open, embedded Brain events use a different analytics context and cannot read Desktop's persisted UUID. Deployment creation can be blocked by GTM's missing-identity rule, and the current GTM whitelist omits onboarding/cancellation events.Expose an optional analytics capability through the existing host-config API and accept Brain events through the existing SDK event bus. Event callbacks receive browser-provided source/origin metadata; the relay accepts only the running Brain iframe and its installed origin. GTM-covered events enter the parent dataLayer once, inheriting the canonical Desktop UUID and attribution. Events absent from the GTM whitelist use the parent Rybbit SDK once, identifying with that same UUID and respecting the primitive/2KB property contract. Direct delivery waits for asynchronous SDK loading; event fields are allowlisted.
Companion Brain PR: labring/brain#359. Deploy this Desktop change first for immediate continuity. Either PR remains independently mergeable; Brain negotiates capability and keeps its previous transport on older Desktop deployments. Existing website token-login tracking from main is retained.
Validation:
pnpm test:ci src/__tests__/unit/utils/brain-analytics.test.ts src/__tests__/unit/utils/brain-analytics-sdk.test.ts src/__tests__/unit/utils/gtm.test.ts src/__tests__/unit/utils/marketing-attribution.test.tsfromfrontend/desktop.pnpm exec tsc --noEmit --incremental falsefromfrontend/desktop.pnpm buildfromfrontend/packages/client-sdk.