Guides / Signups & Auth

How to Track User Signups in Next.js

3 min readยทSignups & Auth

The Problem

You ship your Next.js app, users start signing up, and you have no idea it's happening unless you manually check your database. There's no buzz, no signal โ€” you find out 3 days later when you look at your dashboard.

The Solution

Call logit.now() right after you persist the new user. You'll get a push notification the moment it happens.

Setup

bash
npm install logit

Create lib/logit.ts:

ts
import { init } from "logit";
export const logit = init({ token: process.env.LOGIT_API_KEY! });

In a server action (App Router)

ts
// app/actions/auth.ts
"use server";
import { logit } from "@/lib/logit";

export async function signupAction(formData: FormData) {
  const email = formData.get("email") as string;

  // ... create user in your DB

  await logit.now("signups", {
    event: "New user signed up",
    description: email,
    icon: "๐Ÿ‘ค",
    notify: true,
    tags: { source: "signup-form" },
    metadata: { email },
  });
}

In an API route

ts
// app/api/auth/signup/route.ts
import { NextResponse } from "next/server";
import { logit } from "@/lib/logit";

export async function POST(req: Request) {
  const { email, plan } = await req.json() as { email: string; plan: string };

  // ... create user

  await logit.now("signups", {
    event: "New user signed up",
    description: `${email} joined on ${plan}`,
    icon: "๐Ÿ‘ค",
    notify: true,
    tags: { plan },
    metadata: { email },
  });

  return NextResponse.json({ ok: true });
}

Tips

  • Use notify: true to receive a push notification immediately โ€” useful when you're heads-down building.
  • Add a source tag if you have multiple signup flows (landing page, referral, invite link) โ€” lets you filter in the dashboard later.
  • Add LOGIT_API_KEY to .env.local and your production environment variables.

Try LogIt free

7-day trial. No credit card required.

Start free