diff options
author | Samuel Newman <mozzius@protonmail.com> | 2024-03-15 12:11:34 +0000 |
---|---|---|
committer | Samuel Newman <mozzius@protonmail.com> | 2024-03-15 12:11:34 +0000 |
commit | f71ec52517fb32d0f3dd1a1a8aa1da1949a752d5 (patch) | |
tree | 3c47bf7e5252ac179add92c5b19d3635a0bd3f49 /src/lib/statsig | |
parent | 8316f97e274504c3fc10dc22017ecbf958727c22 (diff) | |
parent | 4f8381678da505737a96b7420c0f1ea8329f3672 (diff) | |
download | voidsky-f71ec52517fb32d0f3dd1a1a8aa1da1949a752d5.tar.zst |
Merge remote-tracking branch 'origin/main' into samuel/alf-login
Diffstat (limited to 'src/lib/statsig')
-rw-r--r-- | src/lib/statsig/events.ts | 44 | ||||
-rw-r--r-- | src/lib/statsig/statsig.tsx | 8 |
2 files changed, 48 insertions, 4 deletions
diff --git a/src/lib/statsig/events.ts b/src/lib/statsig/events.ts index bc647710c..fa7e597fb 100644 --- a/src/lib/statsig/events.ts +++ b/src/lib/statsig/events.ts @@ -1,5 +1,47 @@ -export type Events = { +export type LogEvents = { init: { initMs: number } + 'feed:endReached': { + feedType: string + itemCount: number + } + 'post:create': { + imageCount: number + isReply: boolean + hasLink: boolean + hasQuote: boolean + langs: string + logContext: 'Composer' + } + 'post:like': { + logContext: 'FeedItem' | 'PostThreadItem' | 'Post' + } + 'post:repost': { + logContext: 'FeedItem' | 'PostThreadItem' | 'Post' + } + 'post:unlike': { + logContext: 'FeedItem' | 'PostThreadItem' | 'Post' + } + 'post:unrepost': { + logContext: 'FeedItem' | 'PostThreadItem' | 'Post' + } + 'profile:follow': { + logContext: + | 'RecommendedFollowsItem' + | 'PostThreadItem' + | 'ProfileCard' + | 'ProfileHeader' + | 'ProfileHeaderSuggestedFollows' + | 'ProfileMenu' + } + 'profile:unfollow': { + logContext: + | 'RecommendedFollowsItem' + | 'PostThreadItem' + | 'ProfileCard' + | 'ProfileHeader' + | 'ProfileHeaderSuggestedFollows' + | 'ProfileMenu' + } } diff --git a/src/lib/statsig/statsig.tsx b/src/lib/statsig/statsig.tsx index a46cef4da..5745d204a 100644 --- a/src/lib/statsig/statsig.tsx +++ b/src/lib/statsig/statsig.tsx @@ -6,7 +6,9 @@ import { } from 'statsig-react-native-expo' import {useSession} from '../../state/session' import {sha256} from 'js-sha256' -import {Events} from './events' +import {LogEvents} from './events' + +export type {LogEvents} const statsigOptions = { environment: { @@ -31,9 +33,9 @@ export function attachRouteToLogEvents( getCurrentRouteName = getRouteName } -export function logEvent<E extends keyof Events>( +export function logEvent<E extends keyof LogEvents>( eventName: E & string, - rawMetadata?: Events[E] & FlatJSONRecord, + rawMetadata: LogEvents[E] & FlatJSONRecord, ) { const fullMetadata = { ...rawMetadata, |