[Statsig] Onboarding and routing events (#3302)

This commit is contained in:
dan 2024-03-21 11:04:02 +00:00 committed by GitHub
parent ad3dd9f6dc
commit 396d183dfc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 282 additions and 201 deletions

View file

@ -1,4 +1,5 @@
export type LogEvents = {
// App events
init: {
initMs: number
}
@ -14,6 +15,35 @@ export type LogEvents = {
secondsActive: number
}
'state:foreground': {}
'router:navigate': {}
// Screen events
'splash:signInPressed': {}
'splash:createAccountPressed': {}
'signup:nextPressed': {
activeStep: number
}
'onboarding:interests:nextPressed': {
selectedInterests: string[]
selectedInterestsLength: number
}
'onboarding:suggestedAccounts:nextPressed': {
selectedAccountsLength: number
skipped: boolean
}
'onboarding:followingFeed:nextPressed': {}
'onboarding:algoFeeds:nextPressed': {
selectedPrimaryFeeds: string[]
selectedPrimaryFeedsLength: number
selectedSecondaryFeeds: string[]
selectedSecondaryFeedsLength: number
}
'onboarding:topicalFeeds:nextPressed': {
selectedFeeds: string[]
selectedFeedsLength: number
}
'onboarding:moderation:nextPressed': {}
'onboarding:finished:nextPressed': {}
'feed:endReached': {
feedType: string
itemCount: number
@ -22,6 +52,10 @@ export type LogEvents = {
feedType: string
reason: 'pull-to-refresh' | 'soft-reset' | 'load-latest'
}
// Data events
'account:create:begin': {}
'account:create:success': {}
'post:create': {
imageCount: number
isReply: boolean

View file

@ -1,13 +1,14 @@
import React from 'react'
import {Platform} from 'react-native'
import {AppState, AppStateStatus} from 'react-native'
import {sha256} from 'js-sha256'
import {
Statsig,
StatsigProvider,
useGate as useStatsigGate,
} from 'statsig-react-native-expo'
import {AppState, AppStateStatus} from 'react-native'
import {useSession} from '../../state/session'
import {sha256} from 'js-sha256'
import {LogEvents} from './events'
export type {LogEvents}
@ -24,7 +25,13 @@ const statsigOptions = {
type FlatJSONRecord = Record<
string,
string | number | boolean | null | undefined
| string
| number
| boolean
| null
| undefined
// Technically not scalar but Statsig will stringify it which works for us:
| string[]
>
let getCurrentRouteName: () => string | null | undefined = () => null