Fire the post:view client event in more places, anywhere a post can be seen (#9467)

* Fire the post:view client event in more places

* Fix bad import

---------

Co-authored-by: Eric Bailey <git@esb.lol>
This commit is contained in:
Alex Benzer
2025-12-05 10:32:19 -08:00
committed by GitHub
parent db81cefb86
commit 9a0cb09d3a
10 changed files with 120 additions and 3 deletions
+26 -2
View File
@@ -492,7 +492,8 @@ let VideoItem = ({
}): React.ReactNode => {
const postShadow = usePostShadow(post)
const {width, height} = useSafeAreaFrame()
const {sendInteraction} = useFeedFeedbackContext()
const {sendInteraction, feedDescriptor} = useFeedFeedbackContext()
const hasTrackedView = useRef(false)
useEffect(() => {
if (active) {
@@ -502,8 +503,31 @@ let VideoItem = ({
feedContext,
reqId,
})
// Track post:view event
if (!hasTrackedView.current) {
hasTrackedView.current = true
logger.metric(
'post:view',
{
uri: post.uri,
authorDid: post.author.did,
logContext: 'ImmersiveVideo',
feedDescriptor,
},
{statsig: false},
)
}
}
}, [active, post.uri, feedContext, reqId, sendInteraction])
}, [
active,
post.uri,
post.author.did,
feedContext,
reqId,
sendInteraction,
feedDescriptor,
])
// TODO: high-performance android phones should also
// be capable of rendering 3 video players, but currently