Skip to content

serverTracker.trackSignUp()

Server-side sign_up. Most useful when sign-up completion happens server-side (account confirmation, OAuth callback) rather than in a client form submission.

serverTracker.trackSignUp(input: ServerSignUpInput): Promise<ServerHelperResult>;
type ServerSignUpInput = {
transactionId?: string;
method?: string;
clientId: string;
userId?: string;
gclid?: string;
gbraid?: string;
wbraid?: string;
userData?: UserData;
consent?: ServerConsent;
};
FieldRequiredNotes
transactionIdnoAuto-generated when missing. Use user.id for dual-send with the browser-side call.
methodnoThe sign-up provider ('email', 'google', …). GA4 method param.
clientIdyesGA4 client ID.
userIdnoThe new user’s ID; sets GA4 user_id.
gclid / gbraid / wbraidnoClick identifiers.
userDatanoSign-up is a high-leverage moment to hash email for Ads enhanced conversions.
consentnoPer-call consent.

Promise<ServerHelperResult> — same shape as trackPurchase.

export async function POST(req: Request) {
const { email, password, gaClientId, gclid } = await req.json();
const user = await createAccount({ email, password });
await serverTracker.trackSignUp({
transactionId: user.id,
method: 'email',
clientId: gaClientId,
userId: user.id,
gclid,
userData: { email: user.email },
});
return Response.json({ user });
}