Fire embed:standardSite:view from feed viewability, not embed mount (#10736)
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -5,7 +5,6 @@ import {plural} from '@lingui/core/macro'
|
||||
import {useLingui} from '@lingui/react/macro'
|
||||
|
||||
import {useHaptics} from '#/lib/haptics'
|
||||
import {useCallOnce} from '#/lib/once'
|
||||
import {shareUrl} from '#/lib/sharing'
|
||||
import {niceDate} from '#/lib/strings/time'
|
||||
import {toNiceDomain} from '#/lib/strings/url-helpers'
|
||||
@@ -104,12 +103,6 @@ export const StandardSiteEmbed = ({
|
||||
}
|
||||
}
|
||||
|
||||
useCallOnce(() => {
|
||||
if (!preview) {
|
||||
ax.metric('embed:standardSite:view', {url: view.uri})
|
||||
}
|
||||
})()
|
||||
|
||||
if (isStandardPublication) {
|
||||
return (
|
||||
<PublicationCard
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
} from 'react-native'
|
||||
import {
|
||||
type AppBskyActorDefs,
|
||||
AppBskyEmbedExternal,
|
||||
AppBskyEmbedVideo,
|
||||
type AppBskyFeedDefs,
|
||||
} from '@atproto/api'
|
||||
@@ -58,6 +59,7 @@ import {
|
||||
} from '#/components/feeds/PostFeedVideoGridRow'
|
||||
import {TrendingInterstitial} from '#/components/interstitials/Trending'
|
||||
import {TrendingVideos as TrendingVideosInterstitial} from '#/components/interstitials/TrendingVideos'
|
||||
import {isStandardSiteEmbed} from '#/components/Post/Embed/StandardSiteEmbed/utils'
|
||||
import {useAnalytics} from '#/analytics'
|
||||
import {IS_IOS, IS_NATIVE, IS_WEB} from '#/env'
|
||||
import {DiscoverFeedLiveEventFeedsAndTrendingBanner} from '#/features/liveEvents/components/DiscoverFeedLiveEventFeedsAndTrendingBanner'
|
||||
@@ -905,6 +907,7 @@ let PostFeed = ({
|
||||
|
||||
const seenActorWithStatusRef = useRef<Set<string>>(new Set())
|
||||
const seenPostUrisRef = useRef<Set<string>>(new Set())
|
||||
const seenStandardSiteUrisRef = useRef<Set<string>>(new Set())
|
||||
|
||||
// Helper to calculate position in feed (count only root posts, not interstitials or thread replies)
|
||||
const getPostPosition = useNonReactiveCallback(
|
||||
@@ -974,6 +977,16 @@ let PostFeed = ({
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Standard site embed view tracking
|
||||
if (
|
||||
AppBskyEmbedExternal.isView(post.embed) &&
|
||||
isStandardSiteEmbed(post.embed.external) &&
|
||||
!seenStandardSiteUrisRef.current.has(post.embed.external.uri)
|
||||
) {
|
||||
seenStandardSiteUrisRef.current.add(post.embed.external.uri)
|
||||
ax.metric('embed:standardSite:view', {url: post.embed.external.uri})
|
||||
}
|
||||
} else if (item.type === 'videoGridRow') {
|
||||
// Track each video in the grid row
|
||||
for (let i = 0; i < item.items.length; i++) {
|
||||
|
||||
Reference in New Issue
Block a user