Skip to content

UI Library for Design Engineers. Animated components and effects you can copy and paste into your apps. Free. Open Source.

✨ feat: Add sign up event tracking

Dillion Verma9dce589b5571
diff --git a/lib/auth.ts b/lib/auth.ts
index 3b72f71e..97cb16ef 100644
--- a/lib/auth.ts
+++ b/lib/auth.ts
@@ -3,6 +3,7 @@ import { EMAIL_FROM } from "@/lib/emails/constants";
import { PrismaAdapter } from "@next-auth/prisma-adapter";
import { NextAuthOptions } from "next-auth";
import EmailProvider from "next-auth/providers/email";
+import posthog from "posthog-js";
import { sendLoginEmail } from "./emails/send-login-email";
import { upsertCustomer } from "./stripe-utils";
@@ -71,6 +72,9 @@ export const authOptions: NextAuthOptions = {
if (message.user.email) {
await upsertCustomer(message.user.email!, message.user.name!);
+ posthog.capture("user_created", {
+ distinct_id: message.user.email,
+ });
// await sendWelcomeEmail(params); // <-- send welcome email
}
},