Fix post view attribution for feed replies (#11622)
This commit is contained in:
@@ -450,6 +450,7 @@ export type Events = {
|
|||||||
'post:view': {
|
'post:view': {
|
||||||
uri: string
|
uri: string
|
||||||
authorDid: string
|
authorDid: string
|
||||||
|
isReply: boolean
|
||||||
logContext:
|
logContext:
|
||||||
| 'FeedItem'
|
| 'FeedItem'
|
||||||
| 'PostThreadItem'
|
| 'PostThreadItem'
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ export function usePostViewTracking(
|
|||||||
ax.metric('post:view', {
|
ax.metric('post:view', {
|
||||||
uri: post.uri,
|
uri: post.uri,
|
||||||
authorDid: post.author.did,
|
authorDid: post.author.did,
|
||||||
|
isReply: !!post.record.reply,
|
||||||
logContext,
|
logContext,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -104,6 +104,7 @@ export function PostThread({uri}: {uri: string}) {
|
|||||||
ax.metric('post:view', {
|
ax.metric('post:view', {
|
||||||
uri: post.uri,
|
uri: post.uri,
|
||||||
authorDid: post.author.did,
|
authorDid: post.author.did,
|
||||||
|
isReply: !!post.record.reply,
|
||||||
logContext: 'Post',
|
logContext: 'Post',
|
||||||
feedDescriptor: feedFeedback.feedDescriptor,
|
feedDescriptor: feedFeedback.feedDescriptor,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -508,6 +508,7 @@ let VideoItem = ({
|
|||||||
ax.metric('post:view', {
|
ax.metric('post:view', {
|
||||||
uri: post.uri,
|
uri: post.uri,
|
||||||
authorDid: post.author.did,
|
authorDid: post.author.did,
|
||||||
|
isReply: !!post.record.reply,
|
||||||
logContext: 'ImmersiveVideo',
|
logContext: 'ImmersiveVideo',
|
||||||
feedDescriptor,
|
feedDescriptor,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1077,15 +1077,22 @@ let PostFeed = ({
|
|||||||
|
|
||||||
onPostSeen(post)
|
onPostSeen(post)
|
||||||
|
|
||||||
// Only track the root post of each slice (index 0) to avoid double-counting thread items
|
// Track the post selected by the feed once it is actually visible.
|
||||||
if (indexInSlice === 0 && !seenPostUrisRef.current.has(post.uri)) {
|
if (
|
||||||
|
post.uri === slice.feedPostUri &&
|
||||||
|
!seenPostUrisRef.current.has(post.uri)
|
||||||
|
) {
|
||||||
seenPostUrisRef.current.add(post.uri)
|
seenPostUrisRef.current.add(post.uri)
|
||||||
|
|
||||||
const position = getPostPosition('sliceItem', item.key)
|
const position = getPostPosition(
|
||||||
|
'sliceItem',
|
||||||
|
slice.items[0]._reactKey,
|
||||||
|
)
|
||||||
|
|
||||||
ax.metric('post:view', {
|
ax.metric('post:view', {
|
||||||
uri: post.uri,
|
uri: post.uri,
|
||||||
authorDid: post.author.did,
|
authorDid: post.author.did,
|
||||||
|
isReply: !!postItem.record.reply,
|
||||||
logContext: 'FeedItem',
|
logContext: 'FeedItem',
|
||||||
feedDescriptor: feedFeedback.feedDescriptor || feed,
|
feedDescriptor: feedFeedback.feedDescriptor || feed,
|
||||||
position,
|
position,
|
||||||
@@ -1121,6 +1128,7 @@ let PostFeed = ({
|
|||||||
ax.metric('post:view', {
|
ax.metric('post:view', {
|
||||||
uri: post.uri,
|
uri: post.uri,
|
||||||
authorDid: post.author.did,
|
authorDid: post.author.did,
|
||||||
|
isReply: !!postItem.record.reply,
|
||||||
logContext: 'FeedItem',
|
logContext: 'FeedItem',
|
||||||
feedDescriptor: feedFeedback.feedDescriptor || feed,
|
feedDescriptor: feedFeedback.feedDescriptor || feed,
|
||||||
position,
|
position,
|
||||||
|
|||||||
Reference in New Issue
Block a user