Skip to content

feat(onboarding): replace Cargo with a PostHog sign-up event - #3187

Open
jul-dan wants to merge 4 commits into
stagingfrom
feat/signup-posthog-hubspot
Open

jul-dan wants to merge 4 commits into
stagingfrom
feat/signup-posthog-hubspot

Conversation

@jul-dan

@jul-dan jul-dan commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Sign-ups no longer go to Cargo. When onboarding creates the organization, the Console sends a user-signed-up PostHog event, and a PostHog → HubSpot destination does what Cargo used to do.

  • Console:
    • The user-signed-up event is sent once, from the completion step that creates the organization, after the profile form. It carries:
      • email, first name, last name, company, job title, phone;
      • organization_id, signup_source: Console;
      • UTM params and gclid.
    • Removed useSignUpCargo and the NX_PUBLIC_CARGO_API_TOKEN env var, including in the build workflow.
    • useCreateUserSignUp no longer tracks anything.
  • PostHog destination (live, outside this repo): HubSpot - Inbound sign-up.
    • Company: finds the company by email domain or creates it, and sets lead_source = Inbound. Personal email domains are skipped. The company is resolved before the contact so HubSpot's auto-association doesn't create a duplicate.
    • Contact: creates or updates it with lifecyclestage = lead and contact_source = Inbound, and associates it with the company. An existing lifecycle stage is never downgraded.
    • Form: submits the HubSpot "Trial - All" form, as Cargo did, so form-based workflows and conversion reporting keep working.

After merge

  • Remove NX_PUBLIC_CARGO_API_TOKEN from the GitHub repository variables.
  • Turn off the Cargo model / HubSpot sync on the Cargo side.
  • Re-enable "Filter out internal and test users" on the PostHog destination. It is temporarily off for testing.

Test plan

  • Unit tests for domains-onboarding-feature and domains-users-sign-up-feature pass.
  • End-to-end test from local onboarding with a new email domain. In HubSpot:
    • one company was created with lead_source = Inbound;
    • the contact was created as lead / Inbound and associated with that company;
    • the "Trial - All" conversion was recorded.

🤖 Generated with Claude Code


Summary by cubic

Sign-ups no longer go to Cargo: onboarding now sends a user-signed-up PostHog event when it creates the organization, and a PostHog → HubSpot destination handles the lead like Cargo did.

  • The event is sent once from the completion step that creates the organization, after the profile form, with profile fields, organization_id, signup_source: Console, and attribution params.
  • Restores UTM/gclid capture at app entry in main.tsx (it stopped working after the move to TanStack Router), and reads stored values via a new getStoredUtmParams helper instead of an onboarding-local copy. Capture is best-effort and never breaks app startup when localStorage is unavailable.
  • Removed useSignUpCargo and the NX_PUBLIC_CARGO_API_TOKEN env var, including from the build workflow.
  • The PostHog destination creates or updates the HubSpot company and contact as inbound leads and submits the "Trial - All" form.

After merge

  • Remove NX_PUBLIC_CARGO_API_TOKEN from the GitHub repository variables.
  • Turn off the Cargo model and its HubSpot sync.
  • Re-enable "Filter out internal and test users" on the PostHog destination (temporarily off for testing).

Written for commit cb3071b. Summary will update on new commits.

View guided diff Turn on auto-fix

Send a `user-signed-up` PostHog event when the onboarding creates the
organization, instead of posting the sign-up to Cargo. A PostHog → HubSpot
destination now creates the contact and company as an inbound lead and
submits the "Trial - All" form, as Cargo did.

Remove the Cargo hook and the NX_PUBLIC_CARGO_API_TOKEN variable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nx-cloud

nx-cloud Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit cb3071b

Command Status Duration Result
nx run console:build --parallel=3 --configurati... ✅ Succeeded 58s View ↗
nx affected --target=test --parallel=3 --config... ✅ Succeeded 4m 22s View ↗
nx affected --target=lint --parallel=3 ✅ Succeeded 2m 30s View ↗
nx-cloud record -- yarn nx format:check ✅ Succeeded 3s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-11-09 10:00:29 UTC

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 8 files

Tip: cubic used a learning from your PR history. Let your coding agent read cubic learnings directly with the cubic MCP.

View guided diff | Turn on auto-fix | Re-trigger cubic

@codecov

codecov Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 55.29%. Comparing base (43fcb9d) to head (cb3071b).
⚠️ Report is 6 commits behind head on staging.

Files with missing lines Patch % Lines
...til-hooks/src/lib/use-utm-params/use-utm-params.ts 85.71% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           staging    #3187      +/-   ##
===========================================
- Coverage    56.39%   55.29%   -1.11%     
===========================================
  Files          944     1375     +431     
  Lines        24242    30898    +6656     
  Branches      7637     9452    +1815     
===========================================
+ Hits         13672    17085    +3413     
- Misses        8435    11214    +2779     
- Partials      2135     2599     +464     
Flag Coverage Δ
unittests 55.29% <90.00%> (-1.11%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

… helper

The UTM capture hook was no longer called since the new UI moved to
TanStack Router, so the sign-up event always sent null attribution.
Call useCaptureUtmParams in App again, before the Auth0 redirect, and read
the stored values with a new getStoredUtmParams in shared/util-hooks
instead of an onboarding-local copy.

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

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

1 issue found across 5 files (changes from recent commits).

Tip: Get a Slack DM when cubic finishes reviewing your PRs. Connect Slack

View guided diff | Turn on auto-fix | Re-trigger cubic

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/console/src/main.tsx">

<violation number="1" location="apps/console/src/main.tsx:190">
P2: This startup call can throw when browser storage is blocked or full, preventing the console from loading for affected users. Make `useCaptureUtmParams` tolerate `localStorage.setItem` failures, as `getStoredUtmParams` already does.</violation>
</file>

Comment thread apps/console/src/main.tsx Resolved
jul-dan and others added 2 commits November 9, 2026 10:49
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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