Auth Funnel Tracking: Where Signup Users Drop Off
EngineeringNovember 27, 202611 min read

Auth Funnel Tracking: Where Signup Users Drop Off

Auth funnels are invisible to most analytics. See every signup drop-off with Clerk and Auth.js.

Picture the dashboard on a Monday. Landing page to signup button: a healthy click-through. Signup button to dashboard: a number that looks fine because the only thing counting is a pageview on /dashboard. Then you compare "signups" against actual trial starts in your billing tool, and the two don't agree.

The gap is usually the auth flow. Users click "Sign up with Google," get bounced to the OAuth screen, and disappear. Your analytics saw the click. It saw the dashboard load for the people who made it. It saw nothing in between: the redirect, the consent screen, the callback, the session creation, the account provisioning.

That in-between stretch is where a lot of drop-off hides, and it's a flow most teams never measure.

This tutorial covers how to instrument auth flows using Clerk or Auth.js (the NextAuth.js successor) with JustAnalytics. We'll track every step from "signup button clicked" to "user takes first action" — all client-side, all simple, no webhooks.

What you'll have by the end

A complete auth funnel with these tracked events:

  • signup_started: user clicked signup, before any redirect
  • oauth_initiated: user chose a social provider
  • signup_completed: account created and session established
  • email_verified: user confirmed their email (Clerk)
  • first_action: user completed onboarding or took a meaningful action

Each event carries the auth provider, referrer and UTM parameters, so you can calculate drop-off between steps and segment by acquisition source.

Prerequisites

  • Next.js 14+ (App Router recommended, Pages Router works too)
  • Either Clerk or Auth.js configured and working
  • A JustAnalytics account with the tracker script installed on your site (here's the Next.js App Router setup). The free tier covers 100K events/month, plenty for testing. Building the funnel view needs the Pro plan ($49/month, or $39/month billed annually).

All the tracking in this tutorial happens in the browser using window.JustAnalytics.track(). No webhooks, no server-side logic, no custom database tables. Just client-side events that fire when users complete key steps.

Part 1: Tracking the signup flow

All the tracking happens in the browser. When a user clicks the signup button or chooses an auth method, fire an event:

Tracking signup button clicks

Wrap your signup trigger. Whether it's a button that opens a modal or a link to Clerk's hosted page, fire an event before the user leaves:

// components/SignupButton.tsx
"use client";

export function SignupButton() {
  function handleClick() {
    // Fire before redirect
    window.JustAnalytics?.track("signup_started", {
      source: "hero_cta",
      referrer: document.referrer,
      utm_source: new URLSearchParams(window.location.search).get("utm_source"),
    });
  }

  return (
    <a href="/sign-up" onClick={handleClick}>
      Start free trial
    </a>
  );
}

Top of the funnel. Compare this count against signup completions and you have your first drop-off metric.

Tracking OAuth provider selection

Clerk's appearance prop only styles its components. It doesn't accept click handlers, so you can't hook provider buttons that way. Build the provider buttons yourself with the useSignIn hook and call authenticateWithRedirect:

// components/AuthForm.tsx
"use client";

import { useSignIn } from "@clerk/nextjs";

export function AuthForm() {
  const { signIn, isLoaded } = useSignIn();

  async function startOAuth(strategy: "oauth_google" | "oauth_github") {
    if (!isLoaded) return;

    window.JustAnalytics?.track("oauth_initiated", {
      provider: strategy.replace("oauth_", ""),
    });

    await signIn.authenticateWithRedirect({
      strategy,
      redirectUrl: "/sso-callback",
      redirectUrlComplete: "/dashboard",
    });
  }

  return (
    <div>
      <button onClick={() => startOAuth("oauth_google")}>Continue with Google</button>
      <button onClick={() => startOAuth("oauth_github")}>Continue with GitHub</button>
    </div>
  );
}

You'll also need a /sso-callback route that renders Clerk's AuthenticateWithRedirectCallback component. Check Clerk's docs for the current setup, since their component names shift between major versions.

For Auth.js, the default /api/auth/signin page gives you no hook, so use a custom sign-in page:

// app/signin/page.tsx
"use client";

import { signIn, getProviders } from "next-auth/react";
import { useEffect, useState } from "react";

export default function SignInPage() {
  const [providers, setProviders] = useState<any>(null);

  useEffect(() => {
    getProviders().then(setProviders);
  }, []);

  function handleProviderClick(providerId: string) {
    window.JustAnalytics?.track("oauth_initiated", {
      provider: providerId,
    });
    signIn(providerId, { callbackUrl: "/dashboard" });
  }

  if (!providers) return <div>Loading...</div>;

  return (
    <div>
      {Object.values(providers).map((provider: any) => (
        <button
          key={provider.id}
          onClick={() => handleProviderClick(provider.id)}
        >
          Sign in with {provider.name}
        </button>
      ))}
    </div>
  );
}

Client-side tracking covers only what happens in your pages. The rest happens where your script can't reach, and that part matters most.

Part 2: Tracking the signup success page

When a user completes signup and reaches your dashboard or onboarding screen, fire the signup_completed event from the client:

// app/dashboard/page.tsx
"use client";

import { useEffect } from "react";
import { useUser } from "@clerk/nextjs"; // or useSession from next-auth

export default function Dashboard() {
  const { user } = useUser();

  useEffect(() => {
    if (!user?.createdAt) return;

    // Check if this is a new account (created within the last minute)
    const isNewAccount = Date.now() - user.createdAt.getTime() < 60000;

    if (isNewAccount) {
      window.JustAnalytics?.track("signup_completed", {
        provider: user.externalAccounts?.[0]?.provider ?? "email",
        account_age_ms: Date.now() - user.createdAt.getTime(),
      });
    }
  }, [user]);

  return <div>Welcome to your dashboard</div>;
}

This is the simplest approach: track signup completion when the user lands on your authenticated page. No webhooks, no server-side queues, just a single client-side event.

For Auth.js, use the session object instead:

// app/dashboard/page.tsx
"use client";

import { useEffect } from "react";
import { useSession } from "next-auth/react";

export default function Dashboard() {
  const { data: session } = useSession();

  useEffect(() => {
    if (!session?.user) return;

    window.JustAnalytics?.track("signup_completed", {
      provider: session.provider ?? "email",
    });
  }, [session]);

  return <div>Welcome to your dashboard</div>;
}

Two caveats. Auth.js doesn't put the provider on the session by default, so unless you copy account.provider onto the token in the jwt callback and onto the session in the session callback, this reports "email" every time. And as written it fires for every signed-in visit, returning logins included, because the session doesn't say whether the account is new. A sessionStorage flag at least stops repeats within one browser session:

useEffect(() => {
  if (!session?.user) return;
  if (sessionStorage.getItem("ja_signup_tracked")) return;

  window.JustAnalytics?.track("signup_completed", {
    provider: session.provider ?? "email",
  });
  sessionStorage.setItem("ja_signup_tracked", "true");
}, [session]);

That still counts a returning user once per browser session. To count only new accounts, use the isNewUser flag covered in the FAQ below.

Part 3: Tracking email verification (Clerk only)

If your product requires email verification before unlocking features, track when users verify:

// components/VerifyEmailPrompt.tsx
"use client";

import { useUser } from "@clerk/nextjs";
import { useEffect } from "react";

export function VerifyEmailPrompt() {
  const { user, isLoaded } = useUser();

  useEffect(() => {
    if (!isLoaded || !user) return;

    const isVerified = user.primaryEmailAddress?.verification?.status === "verified";
    if (isVerified && !sessionStorage.getItem("email_verified_tracked")) {
      window.JustAnalytics?.track("email_verified", {});
      sessionStorage.setItem("email_verified_tracked", "true");
    }
  }, [user, isLoaded]);

  if (user && user.primaryEmailAddress?.verification?.status !== "verified") {
    return <div>Please verify your email to continue.</div>;
  }

  return null;
}

Mount this in your authenticated layout. It fires the first time a browser session sees the user verified, which for a new signup is close to the moment of verification. A returning verified user fires it once per browser session too, so read the count as approximate. Keep the email address itself out of the event: an event name is enough for the funnel.

Part 4: Tracking first-action completion

Signup isn't conversion. A user with an account who never does anything is a vanity metric. Real conversion is the first meaningful action: uploading a file, connecting an integration, inviting a teammate, whatever "activated" means for your product.

Add a client-side event when they complete it:

// app/onboarding/complete/page.tsx
"use client";

import { useEffect } from "react";
import { useUser } from "@clerk/nextjs"; // or useSession from next-auth

export default function OnboardingComplete() {
  const { user } = useUser();

  useEffect(() => {
    if (!user) return;
    window.JustAnalytics?.track("first_action", {
      action_type: "onboarding_completed",
      time_to_action_ms: Date.now() - (user.createdAt?.getTime() ?? Date.now()),
    });
  }, [user]);

  return <div>Welcome! You're all set.</div>;
}

Now you have the full funnel: signup_started → oauth_initiated → signup_completed → first_action. Calculate the conversion rate between each step and you'll know where users are dropping.

Reading the funnel in JustAnalytics

With events flowing, build a funnel view (the cookieless conversion funnel walkthrough covers this in more depth). Conversion funnels are part of the Pro plan:

  1. Go to your JustAnalytics dashboard
  2. Navigate to Funnels
  3. Create a new funnel with steps: signup_started, signup_completed, first_action
  4. Segment by provider to compare auth methods

Social login removes password-creation friction, so it often converts better at the signup step. Email/password users made a deliberate choice, so it's worth checking whether they retain better a month later. Don't assume either. Track both paths and look.

Hot take: if you're optimizing purely for signup conversion, you're probably optimizing for the wrong thing. Retention usually tells you more about whether the signup flow is working.

Common errors and how to fix them

window.JustAnalytics is undefined when the track call runs. The analytics script is loading asynchronously. Use optional chaining (?.track) as shown in the examples, or wrap it in a check: if (window.JustAnalytics) { window.JustAnalytics.track(...) }.

Events fire multiple times per session. The signup_completed event fires every time the user's data loads in useEffect if you don't guard against it. Add a sessionStorage flag or check the account's creation time (only track if account is less than 1 minute old) to fire once.

UTM parameters are lost by the time signup_completed fires. Capture UTM parameters on the signup_started event client-side, then pass them through the properties object on signup_completed. Or fetch them from the user's metadata if your auth provider stored them during signup.

Segmenting by provider shows undefined for email signups. Some Clerk instances report email signups with an empty externalAccounts array. Use the fallback: provider: user.externalAccounts?.[0]?.provider ?? "email" to catch these cases.

What this won't fix

Tracking auth funnels doesn't fix broken auth UX. If your OAuth consent screen asks for every permission under the sun, users will bail and no amount of analytics will tell you why. They're gone before any of your code runs.

Similarly, if you're seeing big drop-off between signup_completed and first_action, the problem is onboarding friction, not auth tracking. But at least you know where to look.

For teams running paid traffic into these funnels, comparing signup drop-off against traffic quality is worth doing. Automated traffic can hit your signup button without ever completing OAuth, so a source with plenty of clicks and almost no completions deserves a closer look. ClickzProtect pairs well here: you can cross-reference click fraud detection data with funnel drop-off by source before the ad budget disappears.

Next steps

You've got end-to-end auth funnel tracking. The next thing most teams want is an alert when conversion dips below a threshold, because nobody wants to discover a broken OAuth integration from a revenue report three days late.

You can also build a simple check into your deploy pipeline: query yesterday's signup conversion rate, fail the deploy if it dropped more than 20% from baseline.

For correlating auth errors with funnel drops, see our guide on linking error tracking with conversion data. Few things sting like a signup_completed record with no session behind it because of a silent database error.

Frequently Asked Questions

Does this work with Clerk's hosted sign-in pages?

Yes. The useUser() hook works the same whether users go through embedded signup components or Clerk's hosted pages — either way, they land on your dashboard with a session, and the tracking fires there. You lose visibility into the exact OAuth flow (whether they hit back, closed a tab, etc.) but you still get a clean signup_completed signal.

Can I track social logins separately from email/password signups?

Yes. The provider property in the tracking code captures google, github, email, etc. Pass it and you can segment by auth method in your JustAnalytics dashboard. Social login usually removes password-creation friction, while email/password users make a more deliberate choice, so compare retention between the two.

What if a user bounces during OAuth and closes the tab?

The tracking is entirely client-side, so a user who never reaches your dashboard won't fire any events. This is the tradeoff of simplicity — you can't measure silent drops during OAuth. If you need that visibility, you'd need server-side logging, which adds complexity.

How do I avoid counting returning logins as new signups?

Check the account's creation time: if the account is less than 1 minute old, it's a new signup. The Clerk snippet does this with Date.now() - user.createdAt.getTime() < 60000. For Auth.js, use the isNewUser flag passed to the signIn event if you've wired up a database adapter.


Try JustAnalytics

All-in-one observability in one under-5KB script: cookieless analytics + error tracking + APM + session replay + uptime + structured logs. Replaces GA4 + Sentry + Datadog + Pingdom + LogRocket. Free tier (100K events/mo), Pro $49/month ($39 annual).

Start free → · AI Command Center MCP

JP
JustAnalytics Platform TeamContributor

Author at JustAnalytics.

Related posts