Skip to content

feat(analytics): track mobile-web signup as Meta Pixel Lead#2710

Merged
evanhutnik merged 6 commits into
mainfrom
evan/mobile-conversion
Apr 21, 2026
Merged

feat(analytics): track mobile-web signup as Meta Pixel Lead#2710
evanhutnik merged 6 commits into
mainfrom
evan/mobile-conversion

Conversation

@evanhutnik
Copy link
Copy Markdown
Contributor

@evanhutnik evanhutnik commented Apr 21, 2026

Summary

Wire up Meta Pixel conversion tracking for the signup funnel — both the mobile-web lead-capture step and the final onboarding launch step — and add a typed API that keeps future Meta standard event calls correct by default.

  • MobileWebSignupSent fires Meta's standard Lead event on mount alongside the existing PostHog mobile_web_signup_sent_viewed event. Carries content_name: 'mobile_web_signup' so it can be split from future Lead surfaces via a Custom Conversion.
  • launch.tsx (final onboarding step, mobile-only) fires CompleteRegistration on mount with content_name: 'onboarding_launch' and content_category: <tier>. tier is read from the ?type= URL param set by Stripe's success redirect (see choose-plan.tsx), defaulting to 'free' for users who skipped Stripe. Possible values: free | haiku | sonnet | opus.
  • analytics.trackMeta(event, data?) — new typed method on the analytics interface. event is constrained to the MetaStandardEvent union (Lead, Purchase, CompleteRegistration, etc.), so custom names and typos fail at compile time. Prefer this over track(..., ['meta-pixel']) for standard events — Meta's optimization models are pre-trained on the standard taxonomy, standard events get priority slots in iOS 14.5+ Aggregated Event Measurement, and Ads Manager surfaces them natively.
  • The generic track(..., ['meta-pixel']) path now routes non-standard event names through fbq('trackCustom', ...) instead of fbq('track', ...), eliminating Pixel Helper warnings for existing callers (e.g. sign_up).

Meta Ads Manager follow-up

Create Custom Conversions in Events Manager:

  • Mobile-web lead: Lead where content_name equals mobile_web_signup
  • All completed registrations: CompleteRegistration
  • Paid conversions only: CompleteRegistration where content_category != free
  • Per-tier conversions: CompleteRegistration where content_category = haiku | sonnet | opus

Then point the relevant ad sets at each conversion.

evanhutnik and others added 3 commits April 21, 2026 10:33
Introduces analytics.trackMeta() typed to the Meta Pixel standard event
union so compile-time rejects custom names. Migrates MobileWebSignupSent
to use it, firing Lead with content_name for mobile-web signup surface.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 21, 2026

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 21, 2026

Warning

Rate limit exceeded

@evanhutnik has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 14 minutes and 45 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 14 minutes and 45 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 5f4d53f3-b6ec-4a63-b912-5981ba37983b

📥 Commits

Reviewing files that changed from the base of the PR and between 82503fd and 78562b5.

📒 Files selected for processing (1)
  • js/app/packages/app/component/interactive-onboarding/lessons/launch.tsx
📝 Walkthrough

Walkthrough

The PR introduces Meta Pixel standard event support to the analytics system by adding a typed list of standard event names and a new trackMeta() helper function. It updates Meta Pixel event dispatch to use fbq('track', ...) for standard events and fbq('trackCustom', ...) for custom events. An additional analytics call is added to the MobileWebSignupSent component.

Changes

Cohort / File(s) Summary
Meta Pixel Analytics Infrastructure
js/app/packages/app/lib/analytics/analytics.ts
Added META_STANDARD_EVENT_NAMES list and exported MetaStandardEvent type. Changed Meta Pixel event dispatch logic to differentiate between standard and custom events. Added trackMeta() helper method to createAnalytics() return object and AnalyticsInterface.
Mobile Web Signup Analytics
js/app/packages/app/component/interactive-onboarding/MobileWebSignupSent.tsx
Added analytics.trackMeta('Lead', { content_name: 'mobile_web_signup' }) call during component onMount lifecycle.

Possibly related PRs

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The pull request title follows the conventional commits format with 'feat:' prefix, is under 72 characters (59 total), and accurately describes the main change: adding Meta Pixel Lead event tracking for mobile-web signup.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The PR description comprehensively explains all changes: the analytics.trackMeta() API addition, MobileWebSignupSent Meta Pixel Lead event integration, and the generic track() routing improvements for non-standard events.

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


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.

Copy link
Copy Markdown
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.

Actionable comments posted: 2

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

Inline comments:
In `@js/app/packages/app/lib/analytics/analytics.ts`:
- Around line 151-156: META_STANDARD_EVENTS.has(event) is case-sensitive so
callers using wrong casing (e.g. 'lead' vs 'Lead') get routed to trackCustom;
fix by doing a case-insensitive lookup and using the canonical-cased event when
available. Create a map from META_STANDARD_EVENTS entries lowercased to their
canonical form (e.g. LOWER_TO_CANONICAL), then replace the check with a lookup:
const canonical = LOWER_TO_CANONICAL.get(event.toLowerCase()); if canonical is
present use fbq('track', canonical, enriched) else use fbq('trackCustom', event,
enriched); also add a short code comment referencing META_STANDARD_EVENTS and
trackMeta to explain why we normalize.
- Around line 74-97: Replace the parallel array+set pair by a single canonical
Set to avoid duplication: remove META_STANDARD_EVENT_NAMES and create one const
META_STANDARD_EVENTS initialized with the string literals (as const) so you can
still derive MetaStandardEvent from it (use a type derived from the set's
values), and update any call sites that check membership (e.g. .has(event)) to
cast the checked value to MetaStandardEvent where necessary (or keep `.has`
typed as Set<string> if preferred). Ensure you update references to
META_STANDARD_EVENT_NAMES to use META_STANDARD_EVENTS and adjust the
MetaStandardEvent type to read from the new constant.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: fc8361e5-da5d-49e3-8344-50d4b40ae8dc

📥 Commits

Reviewing files that changed from the base of the PR and between f9bb1f8 and 82503fd.

📒 Files selected for processing (2)
  • js/app/packages/app/component/interactive-onboarding/MobileWebSignupSent.tsx
  • js/app/packages/app/lib/analytics/analytics.ts

Comment thread js/app/packages/app/lib/analytics/analytics.ts
Comment thread js/app/packages/app/lib/analytics/analytics.ts
@evanhutnik evanhutnik merged commit 8f7519e into main Apr 21, 2026
22 checks passed
@evanhutnik evanhutnik deleted the evan/mobile-conversion branch April 21, 2026 15:53
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