Guides / Signups & Auth
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.
// 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() },
});
}
// 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(),
});
}
Use separate channels per source for extra visibility:
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.
signups-google vs signups-email volume after any landing page changeTry LogIt free
7-day trial. No credit card required.