[Statsig] Track likes, reposts, follows (#3195)
* [Statsig] Track likes * Move tracking to intent * Track repost/unrepost * Track profile follows/unfollows * Less copy paste * Reorder
This commit is contained in:
parent
db79c918b2
commit
7eaa573b57
15 changed files with 125 additions and 30 deletions
|
@ -1,5 +1,35 @@
|
|||
export type Events = {
|
||||
export type LogEvents = {
|
||||
init: {
|
||||
initMs: number
|
||||
}
|
||||
'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'
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue