Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

feat(web): add auth_surface tracking to login and signup forms

Richie McIlroy09eb901dac51
diff --git a/apps/web/app/(org)/login/form.tsx b/apps/web/app/(org)/login/form.tsx
index 3d631c0f0..50ffff273 100644
--- a/apps/web/app/(org)/login/form.tsx
+++ b/apps/web/app/(org)/login/form.tsx
@@ -105,7 +105,11 @@ export function LoginForm() {
}, [emailSent]);
const handleGoogleSignIn = () => {
- trackEvent("auth_started", { method: "google", is_signup: true });
+ trackEvent("auth_started", {
+ method: "google",
+ is_signup: false,
+ auth_surface: "login",
+ });
signIn("google", {
...(next && next.length > 0 ? { callbackUrl: next } : {}),
});
@@ -267,7 +271,8 @@ export function LoginForm() {
setLoading(true);
trackEvent("auth_started", {
method: "email",
- is_signup: !oauthError,
+ is_signup: false,
+ auth_surface: "login",
});
const normalizedEmail = email.trim().toLowerCase();
signIn("email", {
@@ -284,6 +289,9 @@ export function LoginForm() {
setEmailSent(true);
setLastEmailSentTime(Date.now());
trackEvent("auth_email_sent", {
+ method: "email",
+ is_signup: false,
+ auth_surface: "login",
email_domain: normalizedEmail.split("@")[1],
});
const params = new URLSearchParams({
diff --git a/apps/web/app/(org)/signup/form.tsx b/apps/web/app/(org)/signup/form.tsx
index 7ec96287e..c35635d41 100644
--- a/apps/web/app/(org)/signup/form.tsx
+++ b/apps/web/app/(org)/signup/form.tsx
@@ -105,7 +105,11 @@ export function SignupForm() {
}, [emailSent]);
const handleGoogleSignIn = () => {
- trackEvent("auth_started", { method: "google", is_signup: true });
+ trackEvent("auth_started", {
+ method: "google",
+ is_signup: true,
+ auth_surface: "signup",
+ });
signIn("google", {
...(next && next.length > 0 ? { callbackUrl: next } : {}),
});
@@ -268,6 +272,7 @@ export function SignupForm() {
trackEvent("auth_started", {
method: "email",
is_signup: true,
+ auth_surface: "signup",
});
const normalizedEmail = email.trim().toLowerCase();
signIn("email", {
@@ -284,6 +289,9 @@ export function SignupForm() {
setEmailSent(true);
setLastEmailSentTime(Date.now());
trackEvent("auth_email_sent", {
+ method: "email",
+ is_signup: true,
+ auth_surface: "signup",
email_domain: normalizedEmail.split("@")[1],
});
const params = new URLSearchParams({