Skip to content

feat(webapp): add tracking for Vercel GitHub steps#3093

Closed
0ski wants to merge 1 commit intooskar/feat-vercel-deployments-ui-improvementsfrom
oskar/fix-more-posthog-vercel-events
Closed

feat(webapp): add tracking for Vercel GitHub steps#3093
0ski wants to merge 1 commit intooskar/feat-vercel-deployments-ui-improvementsfrom
oskar/fix-more-posthog-vercel-events

Conversation

@0ski
Copy link
Collaborator

@0ski 0ski commented Feb 19, 2026

Add telemetry events to the Vercel onboarding modal to better track
user interactions with the GitHub integration flow. Specifically:

  • Fire an event when the GitHub step is shown, including whether the
    GitHub app is already installed (github_app_installed).
  • Track when the user clicks the "Install GitHub app" button.
  • Track when the user completes the GitHub onboarding step.
  • Track when the user skips the GitHub onboarding step (applies to
    multiple skip paths).

Also add gitHubAppInstallations.length to the effect dependency array
to ensure the "step viewed" event updates correctly when installation
state changes.

These events improve analytics for onboarding funnels and help identify
drop-off or friction points in the GitHub integration flow.


This is part 1 of 1 in a stack made with GitButler:

@changeset-bot
Copy link

changeset-bot bot commented Feb 19, 2026

⚠️ No Changeset found

Latest commit: a12317c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 19, 2026

Walkthrough

Adds telemetry tracking to the Vercel onboarding modal by emitting tracking events at multiple points in the GitHub connection flow (e.g., step viewed, GitHub app install clicked, completed, and skipped). Expands the main useEffect dependency array to include trackOnboarding, capture, organizationSlug, projectSlug, and gitHubAppInstallations.length so the effect re-runs when those values change. Inserts tracking calls into UI interaction handlers and related control-flow branches to ensure events are captured for install, complete, skip, and redirect scenarios.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat(webapp): add tracking for Vercel GitHub steps' clearly and concisely summarizes the main change of adding telemetry tracking to the Vercel GitHub onboarding flow.
Description check ✅ Passed The description provides clear details about what telemetry events were added and why, but does not include the Testing or Screenshots sections from the required template.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch oskar/fix-more-posthog-vercel-events

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@0ski 0ski marked this pull request as draft February 19, 2026 15:50
devin-ai-integration[bot]

This comment was marked as resolved.

@0ski 0ski marked this pull request as ready for review February 19, 2026 15:51
Add telemetry events to the Vercel onboarding modal to better track
user interactions with the GitHub integration flow. Specifically:
- Fire an event when the GitHub step is shown, including whether the
  GitHub app is already installed (github_app_installed).
- Track when the user clicks the "Install GitHub app" button.
- Track when the user completes the GitHub onboarding step.
- Track when the user skips the GitHub onboarding step (applies to
  multiple skip paths).

Also add gitHubAppInstallations.length to the effect dependency array
to ensure the "step viewed" event updates correctly when installation
state changes.

These events improve analytics for onboarding funnels and help identify
drop-off or friction points in the GitHub integration flow.
coderabbitai[bot]

This comment was marked as resolved.

@0ski 0ski force-pushed the oskar/fix-more-posthog-vercel-events branch from aa0421c to a12317c Compare February 19, 2026 15:57
@0ski 0ski changed the title feat(onboarding): add tracking for Vercel GitHub steps feat(webapp): add tracking for Vercel GitHub steps Feb 19, 2026
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/webapp/app/components/integrations/VercelOnboardingModal.tsx (1)

1117-1160: ⚠️ Potential issue | 🟡 Minor

"vercel onboarding completed" silently dropped on the redirect paths; double-fired on the skip-without-redirect path.

Two inconsistencies arise from combining synchronous window.location.href redirects with a state-machine–driven useEffect completion tracker (lines 582–590):

  1. "Complete" button (line 1120–1127, marketplace + GitHub connected + nextUrl):
    trackOnboarding("vercel onboarding github completed") fires, then setState("completed"), then window.location.href = validUrl. The page navigates away before React flushes effects, so the useEffect at line 582 never executes and "vercel onboarding completed" is never emitted for this path.

  2. Skip button without redirect (lines 1135–1136 for non-marketplace, lines 1154–1155 for the cancel variant):
    trackOnboarding("vercel onboarding github skipped") fires, then setState("completed"). Because there is no redirect, the useEffect at line 582 does execute — emitting a second event "vercel onboarding completed" and calling onClose(). This path double-fires completion tracking.

If "vercel onboarding completed" is used as the canonical completion counter in any funnel, the marketplace-with-redirect path will be under-counted.

🛠️ Suggested fix: emit `"vercel onboarding completed"` explicitly before redirecting and suppress the useEffect for GitHub-step transitions
-  trackOnboarding("vercel onboarding github completed");
-  setState("completed");
-  const validUrl = safeRedirectUrl(nextUrl);
-  if (validUrl) {
-    window.location.href = validUrl;
-  }
+  trackOnboarding("vercel onboarding github completed");
+  trackOnboarding("vercel onboarding completed", { github_connected: true });
+  hasTrackedCompletionRef.current = true;   // prevent useEffect double-fire
+  setState("completed");
+  const validUrl = safeRedirectUrl(nextUrl);
+  if (validUrl) {
+    window.location.href = validUrl;
+  }

Apply the same pattern for skip handlers that redirect:

   trackOnboarding("vercel onboarding github skipped");
+  trackOnboarding("vercel onboarding completed", { github_connected: isGitHubConnectedForOnboarding });
+  hasTrackedCompletionRef.current = true;
   setState("completed");
   if (fromMarketplaceContext && nextUrl) { ...
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/webapp/app/components/integrations/VercelOnboardingModal.tsx` around
lines 1117 - 1160, The completion tracking is inconsistent because redirects
happen before the useEffect that emits the canonical "vercel onboarding
completed" runs and some non-redirect paths cause a double-fire; update the
click handlers that perform a redirect (the Complete and any Skip handlers that
call window.location.href via safeRedirectUrl) to call trackOnboarding("vercel
onboarding github completed") immediately before doing the redirect, and add a
boolean ref (e.g., suppressCompletionEffectRef) that you set true in those
redirecting handlers so the existing useEffect that watches state ===
"completed" (the effect that currently emits "vercel onboarding completed" and
calls onClose) will early-return when suppressCompletionEffectRef.current is
true; for non-redirecting Skip handlers keep the existing setState("completed")
so the useEffect emits once — use the existing symbols trackOnboarding,
setState, safeRedirectUrl, onClose, and the useEffect that handles "completed".
📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between aa0421c and a12317c.

📒 Files selected for processing (1)
  • apps/webapp/app/components/integrations/VercelOnboardingModal.tsx
🧰 Additional context used
📓 Path-based instructions (6)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx}: Use types over interfaces for TypeScript
Avoid using enums; prefer string unions or const objects instead

**/*.{ts,tsx}: Always import tasks from @trigger.dev/sdk, never use @trigger.dev/sdk/v3 or deprecated client.defineJob pattern
Every Trigger.dev task must be exported and have a unique id property with no timeouts in the run function

Files:

  • apps/webapp/app/components/integrations/VercelOnboardingModal.tsx
{packages/core,apps/webapp}/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use zod for validation in packages/core and apps/webapp

Files:

  • apps/webapp/app/components/integrations/VercelOnboardingModal.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use function declarations instead of default exports

Import from @trigger.dev/core using subpaths only, never import from root

Files:

  • apps/webapp/app/components/integrations/VercelOnboardingModal.tsx
apps/webapp/app/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/webapp.mdc)

Access all environment variables through the env export of env.server.ts instead of directly accessing process.env in the Trigger.dev webapp

Files:

  • apps/webapp/app/components/integrations/VercelOnboardingModal.tsx
apps/webapp/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/webapp.mdc)

apps/webapp/**/*.{ts,tsx}: When importing from @trigger.dev/core in the webapp, use subpath exports from the package.json instead of importing from the root path
Follow the Remix 2.1.0 and Express server conventions when updating the main trigger.dev webapp

Access environment variables via env export from apps/webapp/app/env.server.ts, never use process.env directly

Files:

  • apps/webapp/app/components/integrations/VercelOnboardingModal.tsx
**/*.{js,ts,jsx,tsx,json,md,yaml,yml}

📄 CodeRabbit inference engine (AGENTS.md)

Format code using Prettier before committing

Files:

  • apps/webapp/app/components/integrations/VercelOnboardingModal.tsx
🧠 Learnings (5)
📓 Common learnings
Learnt from: 0ski
Repo: triggerdotdev/trigger.dev PR: 2994
File: apps/webapp/app/presenters/v3/BranchesPresenter.server.ts:45-45
Timestamp: 2026-02-03T18:27:05.229Z
Learning: In the Vercel integration feature, the GitHub app is responsible for builds and provides git metadata (using source: "trigger_github_app"). The Vercel integration is only for linking deployments between platforms, not for triggering builds or providing git metadata.
📚 Learning: 2026-02-04T16:34:48.876Z
Learnt from: 0ski
Repo: triggerdotdev/trigger.dev PR: 2994
File: apps/webapp/app/routes/vercel.connect.tsx:13-27
Timestamp: 2026-02-04T16:34:48.876Z
Learning: In apps/webapp/app/routes/vercel.connect.tsx, configurationId may be absent for "dashboard" flows but must be present for "marketplace" flows. Enforce this with a Zod superRefine and pass installationId to repository methods only when configurationId is defined (omit the field otherwise).

Applied to files:

  • apps/webapp/app/components/integrations/VercelOnboardingModal.tsx
📚 Learning: 2026-02-03T18:27:05.229Z
Learnt from: 0ski
Repo: triggerdotdev/trigger.dev PR: 2994
File: apps/webapp/app/presenters/v3/BranchesPresenter.server.ts:45-45
Timestamp: 2026-02-03T18:27:05.229Z
Learning: In the Vercel integration feature, the GitHub app is responsible for builds and provides git metadata (using source: "trigger_github_app"). The Vercel integration is only for linking deployments between platforms, not for triggering builds or providing git metadata.

Applied to files:

  • apps/webapp/app/components/integrations/VercelOnboardingModal.tsx
📚 Learning: 2025-09-02T11:27:36.336Z
Learnt from: myftija
Repo: triggerdotdev/trigger.dev PR: 2463
File: apps/webapp/app/routes/_app.github.callback/route.tsx:33-44
Timestamp: 2025-09-02T11:27:36.336Z
Learning: In the GitHub App installation callback flow in apps/webapp/app/routes/_app.github.callback/route.tsx, the install session cookie is not cleared after use due to interface limitations with redirectWithSuccessMessage/redirectWithErrorMessage not supporting custom headers. The maintainer accepts this design as the 1-hour cookie expiration provides sufficient protection against replay attacks.

Applied to files:

  • apps/webapp/app/components/integrations/VercelOnboardingModal.tsx
📚 Learning: 2026-02-11T16:37:32.429Z
Learnt from: matt-aitken
Repo: triggerdotdev/trigger.dev PR: 3019
File: apps/webapp/app/components/primitives/charts/Card.tsx:26-30
Timestamp: 2026-02-11T16:37:32.429Z
Learning: In projects using react-grid-layout, avoid relying on drag-handle class to imply draggability. Ensure drag-handle elements only affect dragging when the parent grid item is configured draggable in the layout; conditionally apply cursor styles based on the draggable prop. This improves correctness and accessibility.

Applied to files:

  • apps/webapp/app/components/integrations/VercelOnboardingModal.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (27)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (4, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (5, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (2, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (5, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (2, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (8, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (1, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (8, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (3, 8)
  • GitHub Check: sdk-compat / Deno Runtime
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (6, 8)
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - npm)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (4, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (1, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (3, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (7, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (7, 8)
  • GitHub Check: e2e / 🧪 CLI v3 tests (ubuntu-latest - npm)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (6, 8)
  • GitHub Check: sdk-compat / Cloudflare Workers
  • GitHub Check: units / packages / 🧪 Unit Tests: Packages (1, 1)
  • GitHub Check: sdk-compat / Bun Runtime
  • GitHub Check: e2e / 🧪 CLI v3 tests (ubuntu-latest - pnpm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - pnpm)
  • GitHub Check: sdk-compat / Node.js 20.20 (ubuntu-latest)
  • GitHub Check: sdk-compat / Node.js 22.12 (ubuntu-latest)
  • GitHub Check: typecheck / typecheck
🔇 Additional comments (1)
apps/webapp/app/components/integrations/VercelOnboardingModal.tsx (1)

546-553: Stale-state concern from prior review is resolved here.

Using capture directly with step: "github-connection" hardcoded correctly sidesteps the closure-staleness problem — trackOnboarding's captured state would have still held "build-settings" at the time of call. This is the right fix.

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@apps/webapp/app/components/integrations/VercelOnboardingModal.tsx`:
- Around line 1117-1160: The completion tracking is inconsistent because
redirects happen before the useEffect that emits the canonical "vercel
onboarding completed" runs and some non-redirect paths cause a double-fire;
update the click handlers that perform a redirect (the Complete and any Skip
handlers that call window.location.href via safeRedirectUrl) to call
trackOnboarding("vercel onboarding github completed") immediately before doing
the redirect, and add a boolean ref (e.g., suppressCompletionEffectRef) that you
set true in those redirecting handlers so the existing useEffect that watches
state === "completed" (the effect that currently emits "vercel onboarding
completed" and calls onClose) will early-return when
suppressCompletionEffectRef.current is true; for non-redirecting Skip handlers
keep the existing setState("completed") so the useEffect emits once — use the
existing symbols trackOnboarding, setState, safeRedirectUrl, onClose, and the
useEffect that handles "completed".

---

Duplicate comments:
In `@apps/webapp/app/components/integrations/VercelOnboardingModal.tsx`:
- Line 554: The dependency array for the effect/callback in
VercelOnboardingModal currently uses the property access
gitHubAppInstallations.length; replace that entry with the full reference
gitHubAppInstallations so the hook depends on the array itself (i.e., change
gitHubAppInstallations.length to gitHubAppInstallations in the dependency
array), then run tests/linter to ensure react-hooks/exhaustive-deps is
satisfied.

@0ski 0ski changed the base branch from main to oskar/feat-vercel-deployments-ui-improvements February 19, 2026 17:23
@0ski 0ski closed this Feb 19, 2026
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.

1 participant

Comments