Guides / Signups & Auth

How to Track OAuth vs Email Signups Separately

3 min read·Signups & Auth

Why it matters

If 80% of your signups come from Google OAuth but you're A/B testing your email form, you're wasting time. Tracking signup source tells you which channels actually drive users.

Tag every signup with its source

ts
// lib/track-signup.ts
import { logit } from "@/lib/logit";

type SignupSource = "google" | "github" | "email" | "magic-link" | "apple";

interface SignupData {
  email: string;
  source: SignupSource;
  name?: string;
}

export async function trackNewSignup({ email, source, name }: SignupData) {
  await logit.now("signups", {
    event: "New user signed up",
    description: `${name ?? email} via ${source}`,
    icon: source === "google" ? "🔵" : source === "github" ? "🐙" : "📧",
    notify: true,
    tags: { source },
    metadata: { email, name, source, signedUpAt: new Date().toISOString() },
  });
}

Wire it up by provider

ts
// In your Clerk webhook handler
if (event.type === "user.created") {
  const primaryEmail = event.data.email_addresses[0]?.email_address;
  const oauthAccount = event.data.external_accounts[0];
  const source = oauthAccount?.provider?.replace("oauth_", "") ?? "email";

  await trackNewSignup({
    email: primaryEmail,
    source: source as SignupSource,
    name: `${event.data.first_name} ${event.data.last_name}`.trim(),
  });
}

In your dashboard channels

Use separate channels per source for extra visibility:

ts
await logit.now(`signups-${source}`, {
  event: "New signup",
  description: email,
  icon: "👤",
  notify: true,
});

Now you'll have signups-google, signups-github, signups-email channels. At a glance you know which is growing fastest.

What to do with this data

  • Compare signups-google vs signups-email volume after any landing page change
  • If a spike in signups happened — check the source tag to know what drove it
  • If a provider goes down — you'll see a channel go silent

Try LogIt free

7-day trial. No credit card required.

Start free