Skip to content

feat(analytics): report account signups to X Ads - #9212

Closed
waleedlatif1 wants to merge 2 commits into
stagingfrom
feat/x-signup-conversion-20261018
Closed

waleedlatif1 wants to merge 2 commits into
stagingfrom
feat/x-signup-conversion-20261018

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Reports completed account signups to the X Ads pixel as the "Sim Account Sign Up" event (tw-q5xbl-rhis8), so X Ads campaigns can optimize for signups.
  • Loads the consent-gated X pixel on the signup flow (previously landing pages only), same marketing consent gating.
  • Covers email signups and new social (Google, GitHub) signups; returning logins do not fire.
  • Google Ads conversion labels unchanged; a sign_up label will follow separately.

Type of Change

  • Bug fix / tracking fix

Testing

See agent notes below and CI.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

🤖 Generated with Claude Code

https://claude.ai/code/session_01YXGD8yrPh6YUMvcLKFPQMs

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic review

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@vercel

vercel Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Oct 19, 2026 12:03am UTC

Request Review

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

@cubic review

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@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 11 files

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

Comment thread apps/sim/app/(auth)/signup/complete/social-sign-up-completion.tsx
Comment thread apps/sim/lib/analytics/sign-up.ts
@greptile-apps

greptile-apps Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] Adds signup conversion tracking to X Ads and other vendors.

The previous testing and component requirements still need to be met before merging; no new issue was found.

Findings

  1. P2 Tracking can block signup ▶
  2. P2 Tests skip the signup journey ▶
  3. P2 Required props interfaces are missing ▶

Summary

Reports completed signups to X Ads when marketing consent allows it.

  • New account signups report consent-approved conversion events.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Email signup] --> B{Verification required?}
  B -->|No| C[Report allowed conversions]
  C --> G[Requested page]
  B -->|Yes| D[Save marker and requested page]
  D --> E[Verify email code]
  E --> F[Signup completion page]
  H[New social signup] --> F
  F --> I[Check session, consent, and marker]
  I --> J[Report once if eligible]
  J --> G
  K[Returning social login] --> G
Loading

Reviews (2) · Last reviewed commit: "Pi Babysit: address PR #9212 feedback" · Reviewed by Greptile

Comment on lines +35 to +46
const finishSignUp = async () => {
if (session?.user && isSocialSignInProvider(provider)) {
await trackSocialSignUpConversions({
marker,
provider,
userId: session.user.id,
measurement: consentRequired && measurement,
marketing: consentRequired && marketing,
})
}
window.location.href = destination
}

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.

P2 Tracking can block signup

SocialSignUpCompletion makes the user's redirect depend on outside tracking code. If a vendor function throws, window.location.href never runs, and redirectStartedRef prevents another attempt. Put the redirect in a finally block so a tracking error cannot leave a signed-up user on “Finishing signup…”.

Suggested change
const finishSignUp = async () => {
if (session?.user && isSocialSignInProvider(provider)) {
await trackSocialSignUpConversions({
marker,
provider,
userId: session.user.id,
measurement: consentRequired && measurement,
marketing: consentRequired && marketing,
})
}
window.location.href = destination
}
const finishSignUp = async () => {
try {
if (session?.user && isSocialSignInProvider(provider)) {
await trackSocialSignUpConversions({
marker,
provider,
userId: session.user.id,
measurement: consentRequired && measurement,
marketing: consentRequired && marketing,
})
}
} finally {
window.location.href = destination
}
}

Comment on lines +25 to +30
const trackXEvent = vi.fn()
const trackGoogleEvent = vi.fn()
const trackFreebuffEvent = vi.fn()
window.twq = trackXEvent
window.gtag = trackGoogleEvent
window.freebuff = trackFreebuffEvent

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.

P2 Tests skip the signup journey

The social signup test replaces every vendor function with a mock and checks their calls. CLAUDE.md explicitly forbids tests that mock every collaborator and assert toHaveBeenCalledWith. Replace this with a test through the real signup boundary that checks consent, one-time reporting, and arrival at the requested page. This repository requirement must be satisfied before merging.

Context Used: CLAUDE.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

import { useConsentScript } from '@c15t/nextjs/headless'
import { X_PIXEL_SCRIPT } from '@/lib/consent/scripts'

export function SignupConsentTracking() {

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.

P2 Required props interfaces are missing

SignupConsentTracking has no props interface. The component guide requires one for every component. Add an explicit props interface here and to the new SocialSignUpCompletePage, which has the same omission. This repository requirement must be satisfied before merging.

Context Used: Component patterns and structure for React components (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic review

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

@cubic review

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@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 11 files

Confidence score: 3/5

  • A tracking error in social-sign-up-completion.tsx can leave a signed-up user stuck on “Finishing signup…” instead of redirecting. Move the redirect into a finally block.
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/sim/app/(auth)/signup/complete/social-sign-up-completion.tsx">

<violation number="1" location="apps/sim/app/(auth)/signup/complete/social-sign-up-completion.tsx:37">
P2: Put the redirect in a `finally` block so a tracking error cannot leave a signed-up user stuck on “Finishing signup…”.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

Comment on lines +37 to +46
await trackSignUpCompletionConversions({
marker,
method: provider,
userId: session.user.id,
measurement: consentRequired && measurement,
marketing: consentRequired && marketing,
})
}
window.location.href = destination
}

@cubic-dev-ai cubic-dev-ai Bot Oct 19, 2026 •

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.

P2: Put the redirect in a finally block so a tracking error cannot leave a signed-up user stuck on “Finishing signup…”.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. 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. At apps/sim/app/(auth)/signup/complete/social-sign-up-completion.tsx, line 37:

<comment>Put the redirect in a `finally` block so a tracking error cannot leave a signed-up user stuck on “Finishing signup…”.</comment>

<file context>
@@ -0,0 +1,62 @@
+
+    const finishSignUp = async () => {
+      if (session?.user && isSignUpConversionMethod(provider)) {
+        await trackSignUpCompletionConversions({
+          marker,
+          method: provider,
</file context>
Suggested change
await trackSignUpCompletionConversions({
marker,
method: provider,
userId: session.user.id,
measurement: consentRequired && measurement,
marketing: consentRequired && marketing,
})
}
window.location.href = destination
}
try {
if (session?.user && isSignUpConversionMethod(provider)) {
await trackSignUpCompletionConversions({
marker,
method: provider,
userId: session.user.id,
measurement: consentRequired && measurement,
marketing: consentRequired && marketing,
})
}
} finally {
window.location.href = destination
}
Fix with cubic

@waleedlatif1
waleedlatif1 deleted the feat/x-signup-conversion-20261018 branch October 19, 2026 03:21

This branch was previously deployed

1 inactive deployment
Preview — 70515f3a Deployed Oct 19, 2026 by vercel[bot]
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