Skip to content

Commit

Permalink
[Statsig] Track threads (#6057)
Browse files Browse the repository at this point in the history
* [Statsig] Send thread length

* Split events
  • Loading branch information
gaearon authored Nov 1, 2024
1 parent 1c2186b commit 125ac50
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/lib/statsig/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,16 @@ export type LogEvents = {
'post:create': {
imageCount: number
isReply: boolean
isPartOfThread: boolean
hasLink: boolean
hasQuote: boolean
langs: string
logContext: 'Composer'
}
'thread:create': {
postCount: number
isReply: boolean
}
'post:like:sampled': {
doesLikerFollowPoster: boolean | undefined
doesPosterFollowLiker: boolean | undefined
Expand Down
7 changes: 7 additions & 0 deletions src/view/com/composer/Composer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,7 @@ export const ComposePost = ({
? post.embed.media.images.length
: 0,
isReply: index > 0 || !!replyTo,
isPartOfThread: thread.posts.length > 1,
hasLink: !!post.embed.link,
hasQuote: !!post.embed.quote,
langs: langPrefs.postLanguage,
Expand All @@ -413,6 +414,12 @@ export const ComposePost = ({
index++
}
}
if (thread.posts.length > 1) {
logEvent('thread:create', {
postCount: thread.posts.length,
isReply: !!replyTo,
})
}
}
if (postUri && !replyTo) {
emitPostCreated()
Expand Down

0 comments on commit 125ac50

Please sign in to comment.