Skip to content

[WIP]: feat(onboarding): funnel analytics + variant tagging for the new flow#7960

Open
talissoncosta wants to merge 3 commits into
feat/onboarding-next-quest-cards-7739from
feat/onboarding-analytics-7738
Open

[WIP]: feat(onboarding): funnel analytics + variant tagging for the new flow#7960
talissoncosta wants to merge 3 commits into
feat/onboarding-next-quest-cards-7739from
feat/onboarding-analytics-7738

Conversation

@talissoncosta

Copy link
Copy Markdown
Contributor
  • I have read the Contributing Guide.
  • I have added information to docs/ if required so people know about the feature.
  • I have filled in the "Changes" section below.
  • I have filled in the "How did you test this code" section below.

Changes

Contributes to #7738

Instruments the new single-page onboarding so it sits in one Amplitude funnel, split by variant, alongside the current flow.

  • onboarding_variant user property (control | single_page), set once at identify from the onboarding_quickstart_flow flag. As a user property it splits any funnel by variant with a single "Group by".
  • New flow now emits the milestone events. It auto-creates the project and flag via RTK, which emitted nothing, so the funnel had no project/feature step for the new flow. It now fires First Project created / First Feature created on a real create (org already fired). Milestone events only, not the generic Project/Feature created action events, which stay reserved for resources a user makes by hand.
  • New-flow-only diagnostics for internal drop-off: Onboarding snippet copied (install / wire), Onboarding AI connect used, Onboarding flag toggled.

Activation (first SDK evaluation) is a follow-up, pending #7623's emit shape.

How did you test this code?

Manually, with onboarding_quickstart_flow on and analytics logging enabled:

  1. Sign up, then confirm User register fires and the onboarding_variant = single_page user property is set.
  2. Land on the flow and confirm First Organisation / Project / Feature created each fire once, and not again on revisit.
  3. Copy a snippet, copy the AI prompt, toggle the flag, and confirm the three diagnostics events.
  4. With the flag off (control), confirm the property is onboarding_variant = control.

@vercel

vercel Bot commented Jul 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
flagsmith-frontend-preview Ready Ready Preview, Comment Jul 8, 2026 12:11pm
flagsmith-frontend-staging Ready Ready Preview, Comment Jul 8, 2026 12:11pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Preview Jul 8, 2026 12:11pm

Request Review

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 40f87e95-6ca7-4416-88e6-a00e761168ab

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • ✅ Review completed - (🔄 Check again to review again)

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added feature New feature or request front-end Issue related to the React Front End Dashboard labels Jul 7, 2026
@talissoncosta talissoncosta force-pushed the feat/onboarding-analytics-7738 branch from 97fe9e6 to 10fa440 Compare July 7, 2026 20:01
@github-actions github-actions Bot added feature New feature or request and removed feature New feature or request labels Jul 7, 2026
@talissoncosta talissoncosta force-pushed the feat/onboarding-analytics-7738 branch 2 times, most recently from 3a4e76d to 0a430fe Compare July 7, 2026 20:08
@github-actions github-actions Bot added feature New feature or request and removed feature New feature or request labels Jul 7, 2026
@github-actions github-actions Bot added feature New feature or request and removed feature New feature or request labels Jul 7, 2026
@talissoncosta talissoncosta force-pushed the feat/onboarding-analytics-7738 branch from 0a430fe to 5492b47 Compare July 7, 2026 20:19
@github-actions github-actions Bot added feature New feature or request and removed feature New feature or request labels Jul 7, 2026
@talissoncosta talissoncosta marked this pull request as ready for review July 8, 2026 11:53
@talissoncosta talissoncosta requested a review from a team as a code owner July 8, 2026 11:53
@talissoncosta talissoncosta requested review from kyle-ssg and removed request for a team July 8, 2026 11:53
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Docker builds report

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-api:pr-7960 Finished ✅ Results
ghcr.io/flagsmith/flagsmith:pr-7960 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-private-cloud:pr-7960 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-api-test:pr-7960 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-api:pr-7960 Finished ✅ Results
ghcr.io/flagsmith/flagsmith:pr-7960 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-private-cloud:pr-7960 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-frontend:pr-7960 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-frontend:pr-7960 Finished ✅ Results

@github-actions github-actions Bot added feature New feature or request and removed feature New feature or request labels Jul 8, 2026
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  4 passed

Details

stats  4 tests across 4 suites
duration  41.8 seconds
commit  5492b47
info  🔄 Run: #18086 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  6 passed

Details

stats  6 tests across 4 suites
duration  44.8 seconds
commit  5492b47
info  🔄 Run: #18086 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  2 passed

Details

stats  2 tests across 2 suites
duration  46.9 seconds
commit  5492b47
info  🔄 Run: #18086 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

failed  2 failed
passed  1 passed

Details

stats  3 tests across 3 suites
duration  1 minute, 18 seconds
commit  5492b47
info  📦 Artifacts: View test results and HTML report
🔄 Run: #18086 (attempt 1)

Failed tests

firefox › tests/environment-permission-test.pw.ts › Environment Permission Tests › Environment-level permissions control access to features, identities, and segments @enterprise
firefox › tests/project-permission-test.pw.ts › Project Permission Tests › Project-level permissions control access to features, environments, audit logs, and segments @enterprise

### Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  5 passed

Details

stats  5 tests across 4 suites
duration  1 minute, 12 seconds
commit  5492b47
info  🔄 Run: #18086 (attempt 2)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  4.5 seconds
commit  0267ae7
info  🔄 Run: #18090 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  3 passed

Details

stats  3 tests across 2 suites
duration  10.4 seconds
commit  0267ae7
info  🔄 Run: #18091 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  3 passed

Details

stats  3 tests across 3 suites
duration  46.1 seconds
commit  0267ae7
info  🔄 Run: #18090 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  6 passed

Details

stats  6 tests across 4 suites
duration  20.2 seconds
commit  0267ae7
info  🔄 Run: #18091 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  7 passed

Details

stats  7 tests across 6 suites
duration  48.2 seconds
commit  0267ae7
info  🔄 Run: #18090 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  6 passed

Details

stats  6 tests across 5 suites
duration  58.9 seconds
commit  0267ae7
info  🔄 Run: #18090 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  6 passed

Details

stats  6 tests across 5 suites
duration  19.6 seconds
commit  0267ae7
info  🔄 Run: #18091 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  7 passed

Details

stats  7 tests across 6 suites
duration  49.4 seconds
commit  0267ae7
info  🔄 Run: #18091 (attempt 1)

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Visual Regression

19 screenshots compared. See report for details.
View full report

talissoncosta and others added 3 commits July 8, 2026 09:10
The single-page flow auto-creates the project and flag via RTK, which emit no
analytics, so the onboarding funnel had no project/feature step for the new
flow. Emit the milestone events (First Project created, First Feature created)
on a real create - the milestone the user reached - but not the generic
Project/Feature created action events, which stay reserved for resources a user
makes by hand.

Contributes to #7738

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Set an onboarding_variant user property (control | single_page, from the
onboarding_quickstart_flow flag) once, after Flagsmith resolves it at identify.
As a user property it attaches to every event the user emits, so the shared
funnel can be split by variant with a single Group by, without per-event
tagging or touching the shared stores.

Contributes to #7738

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Emit single_page-only diagnostics for the flow's internal drop-off: onboarding
snippet copied (install / wire), AI-connect used, and the in-page flag toggle,
each carrying org / project / environment IDs (no PII). Kept separate from the
control comparison funnel since the control has no equivalent.

Contributes to #7738

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@talissoncosta talissoncosta changed the title feat(onboarding): funnel analytics + variant tagging for the new flow [WIP]: feat(onboarding): funnel analytics + variant tagging for the new flow Jul 8, 2026
@talissoncosta talissoncosta force-pushed the feat/onboarding-analytics-7738 branch from 5492b47 to 0267ae7 Compare July 8, 2026 12:11
@talissoncosta talissoncosta marked this pull request as draft July 8, 2026 12:11
@talissoncosta talissoncosta marked this pull request as ready for review July 8, 2026 12:13

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 013a9e4c-c310-451f-b31a-9d8a93809700

📥 Commits

Reviewing files that changed from the base of the PR and between 12e69c9 and 0267ae7.

📒 Files selected for processing (7)
  • frontend/common/constants.ts
  • frontend/common/utils/getOnboardingVariant.ts
  • frontend/web/components/pages/onboarding/OnboardingConnectPanel/ConnectWithAiPanel.tsx
  • frontend/web/components/pages/onboarding/OnboardingConnectPanel/OnboardingConnectPanel.tsx
  • frontend/web/components/pages/onboarding/OnboardingFlow/OnboardingFlow.tsx
  • frontend/web/components/pages/onboarding/hooks/bootstrapOnboarding.ts
  • frontend/web/project/api.ts

@@ -0,0 +1,10 @@
import Utils from './utils'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Use the alias import path instead of a relative import.

As per coding guidelines, frontend/**/*.{js,jsx,ts,tsx} should "Use only common/, components/, and project/ import paths; do not use relative imports."

♻️ Proposed fix
-import Utils from './utils'
+import Utils from 'common/utils'
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import Utils from './utils'
import Utils from 'common/utils'

Source: Coding guidelines

Comment on lines +98 to +101
// Auto-created setup is a milestone reached, not a user action: fire First
// Project created, not the generic Project created (reserved for projects a
// user makes by hand). First is safe here - we only get here with no project.
API.trackEvent(Constants.events.CREATE_FIRST_PROJECT)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Guard milestone tracking so analytics failures can't abort onboarding.

Neither API.trackEvent(Constants.events.CREATE_FIRST_PROJECT) nor the CREATE_FIRST_FEATURE call is guarded. If trackEvent throws synchronously (e.g. an uninitialised analytics SDK), the exception propagates through ensureProject/ensureFlag and aborts the whole bootstrap sequence — even though the project/flag were already successfully created. ensureOnboardingTag right below explicitly wraps its logic in try/catch because tagging is "cosmetic only - never block onboarding on tagging"; the same defensive rationale applies to these milestone events.

♻️ Suggested fix
-  API.trackEvent(Constants.events.CREATE_FIRST_PROJECT)
+  try {
+    API.trackEvent(Constants.events.CREATE_FIRST_PROJECT)
+  } catch {
+    // Analytics is best-effort - never block onboarding on tracking failures.
+  }
   if (isFirstFeature) {
-    API.trackEvent(Constants.events.CREATE_FIRST_FEATURE)
+    try {
+      API.trackEvent(Constants.events.CREATE_FIRST_FEATURE)
+    } catch {
+      // Analytics is best-effort - never block onboarding on tracking failures.
+    }
   }

Also applies to: 192-196

Comment on lines +149 to +153
const trackSnippetCopied = (snippet: 'install' | 'wire') =>
API.trackEvent({
...Constants.events.ONBOARDING_SNIPPET_COPIED,
extra: { ...diagnosticIds, snippet },
})

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Extract the inline union type.

As per coding guidelines, frontend/**/*.{ts,tsx} should "Extract inline union types into named types (for example, use type Status = 'A' | 'B' instead of an inline union)." The 'install' | 'wire' parameter type should be named.

♻️ Proposed fix
+type OnboardingSnippet = 'install' | 'wire'
+
-  const trackSnippetCopied = (snippet: 'install' | 'wire') =>
+  const trackSnippetCopied = (snippet: OnboardingSnippet) =>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const trackSnippetCopied = (snippet: 'install' | 'wire') =>
API.trackEvent({
...Constants.events.ONBOARDING_SNIPPET_COPIED,
extra: { ...diagnosticIds, snippet },
})
type OnboardingSnippet = 'install' | 'wire'
const trackSnippetCopied = (snippet: OnboardingSnippet) =>
API.trackEvent({
...Constants.events.ONBOARDING_SNIPPET_COPIED,
extra: { ...diagnosticIds, snippet },
})

Source: Coding guidelines

Comment on lines +251 to +256
// Pin the onboarding variant as a user property once the flag has
// resolved, so every event (incl. autocapture pageviews) is attributable
// to control vs single_page in one funnel (#7738).
API.flagsmithIdentify()?.then(() =>
API.trackTraits({ onboarding_variant: getOnboardingVariant() }),
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Add .catch() to avoid an unhandled promise rejection.

identify()'s try/catch is synchronous, so it won't catch a rejection from this async chain. If flagsmithIdentify() rejects, the appended .then() never runs and the rejection goes unhandled (console warnings, noisy error monitoring). The existing flagsmithIdentify internal chain (lines 151-173) has the same gap, but this new addition extends the unhandled surface further.

🛡️ Suggested fix
       API.flagsmithIdentify()?.then(() =>
         API.trackTraits({ onboarding_variant: getOnboardingVariant() }),
-      )
+      ).catch((err) => console.error('Error tracking onboarding_variant', err))
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// Pin the onboarding variant as a user property once the flag has
// resolved, so every event (incl. autocapture pageviews) is attributable
// to control vs single_page in one funnel (#7738).
API.flagsmithIdentify()?.then(() =>
API.trackTraits({ onboarding_variant: getOnboardingVariant() }),
)
// Pin the onboarding variant as a user property once the flag has
// resolved, so every event (incl. autocapture pageviews) is attributable
// to control vs single_page in one funnel (`#7738`).
API.flagsmithIdentify()?.then(() =>
API.trackTraits({ onboarding_variant: getOnboardingVariant() }),
).catch((err) => console.error('Error tracking onboarding_variant', err))

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

Labels

feature New feature or request front-end Issue related to the React Front End Dashboard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Onboarding: funnel analytics + variant tagging for the new flow

3 participants