File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
apps/dashboard/app/(auth)/register Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 11"use client" ;
22
33import { authClient } from "@databuddy/auth/client" ;
4+ import { track } from "@databuddy/sdk" ;
45import {
56 CaretLeftIcon ,
67 CheckCircleIcon ,
@@ -54,6 +55,20 @@ function RegisterPageContent() {
5455 setFormData ( ( prev ) => ( { ...prev , [ name ] : value } ) ) ;
5556 } ;
5657
58+ const trackSignUp = async (
59+ method : "email" | "social" ,
60+ provider ?: "github" | "google"
61+ ) => {
62+ try {
63+ await track ( "signup_completed" , {
64+ method : method === "social" ? `${ method } _${ provider } ` : method ,
65+ plan : selectedPlan || undefined ,
66+ } ) ;
67+ } catch ( error ) {
68+ console . error ( "Failed to track sign up event:" , error ) ;
69+ }
70+ } ;
71+
5772 const handleAuthSuccess = ( ) => {
5873 if ( callbackUrl ) {
5974 toast . success ( "Account created! Completing integration..." ) ;
@@ -92,6 +107,7 @@ function RegisterPageContent() {
92107 name : formData . name ,
93108 fetchOptions : {
94109 onSuccess : ( ) => {
110+ trackSignUp ( "email" ) . catch ( console . error ) ;
95111 if ( callbackUrl ) {
96112 handleAuthSuccess ( ) ;
97113 } else {
@@ -144,6 +160,7 @@ function RegisterPageContent() {
144160 callbackURL : callbackUrl || "/websites" ,
145161 fetchOptions : {
146162 onSuccess : ( ) => {
163+ trackSignUp ( "social" , provider ) . catch ( console . error ) ;
147164 toast . success ( "Registration successful!" ) ;
148165 handleAuthSuccess ( ) ;
149166 } ,
You can’t perform that action at this time.
0 commit comments