about summary refs log tree commit diff
diff options
context:
space:
mode:
authorHailey <me@haileyok.com>2024-07-01 15:11:04 -0700
committerGitHub <noreply@github.com>2024-07-01 15:11:04 -0700
commit0012c6d40f63ad6ee1dd1fe13d5b56b4e9006425 (patch)
tree4907d7fa0d1d912e499f7469b4b6f509e2cfa7f0
parenta9fe87b842b9e7cfca6f5acbf73aff555ce6eeee (diff)
downloadvoidsky-0012c6d40f63ad6ee1dd1fe13d5b56b4e9006425.tar.zst
Add events to signup for captcha results (#4712)
-rw-r--r--src/lib/statsig/events.ts6
-rw-r--r--src/screens/Signup/StepCaptcha/index.tsx3
-rw-r--r--src/screens/Signup/index.tsx14
3 files changed, 18 insertions, 5 deletions
diff --git a/src/lib/statsig/events.ts b/src/lib/statsig/events.ts
index 3efc11a51..81a2d55e2 100644
--- a/src/lib/statsig/events.ts
+++ b/src/lib/statsig/events.ts
@@ -31,7 +31,13 @@ export type LogEvents = {
   'splash:createAccountPressed': {}
   'signup:nextPressed': {
     activeStep: number
+    phoneVerificationRequired?: boolean
   }
+  'signup:backPressed': {
+    activeStep: number
+  }
+  'signup:captchaSuccess': {}
+  'signup:captchaFailure': {}
   'onboarding:interests:nextPressed': {
     selectedInterests: string[]
     selectedInterestsLength: number
diff --git a/src/screens/Signup/StepCaptcha/index.tsx b/src/screens/Signup/StepCaptcha/index.tsx
index d0fc4e934..b2a91a641 100644
--- a/src/screens/Signup/StepCaptcha/index.tsx
+++ b/src/screens/Signup/StepCaptcha/index.tsx
@@ -6,6 +6,7 @@ import {nanoid} from 'nanoid/non-secure'
 
 import {createFullHandle} from '#/lib/strings/handles'
 import {logger} from '#/logger'
+import {logEvent} from 'lib/statsig/statsig'
 import {ScreenTransition} from '#/screens/Login/ScreenTransition'
 import {useSignupContext, useSubmitSignup} from '#/screens/Signup/state'
 import {CaptchaWebView} from '#/screens/Signup/StepCaptcha/CaptchaWebView'
@@ -39,6 +40,7 @@ export function StepCaptcha() {
   const onSuccess = React.useCallback(
     (code: string) => {
       setCompleted(true)
+      logEvent('signup:captchaSuccess', {})
       submit(code)
     },
     [submit],
@@ -50,6 +52,7 @@ export function StepCaptcha() {
         type: 'setError',
         value: _(msg`Error receiving captcha response.`),
       })
+      logEvent('signup:captchaFailure', {})
       logger.error('Signup Flow Error', {
         registrationHandle: state.handle,
         error,
diff --git a/src/screens/Signup/index.tsx b/src/screens/Signup/index.tsx
index 8d1546fbc..f7ca180bf 100644
--- a/src/screens/Signup/index.tsx
+++ b/src/screens/Signup/index.tsx
@@ -112,6 +112,12 @@ export function Signup({onPressBack}: {onPressBack: () => void}) {
       }
     }
 
+    logEvent('signup:nextPressed', {
+      activeStep: state.activeStep,
+      phoneVerificationRequired:
+        state.serviceDescription?.phoneVerificationRequired,
+    })
+
     // phoneVerificationRequired is actually whether a captcha is required
     if (
       state.activeStep === SignupStep.HANDLE &&
@@ -120,11 +126,7 @@ export function Signup({onPressBack}: {onPressBack: () => void}) {
       submit()
       return
     }
-
     dispatch({type: 'next'})
-    logEvent('signup:nextPressed', {
-      activeStep: state.activeStep,
-    })
   }, [
     _,
     state.activeStep,
@@ -144,11 +146,13 @@ export function Signup({onPressBack}: {onPressBack: () => void}) {
           registrationHandle: state.handle,
         })
       }
-
       dispatch({type: 'prev'})
     } else {
       onPressBack()
     }
+    logEvent('signup:backPressed', {
+      activeStep: state.activeStep,
+    })
   }, [onPressBack, state.activeStep, state.handle])
 
   return (