From 6754e89a746d77a2041ee2e328259b57753fef3f Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Thu, 4 Jun 2026 17:06:31 -0500 Subject: [PATCH] Fire embed:standardSite:view from feed viewability, not embed mount Move the standard site view metric out of the embed (where it fired on mount regardless of visibility) into PostFeed's onItemSeen handler, so it only fires once per URI and only when the post is actually on screen, matching the existing post:view and live:view:post tracking. Co-Authored-By: Claude Opus 4.8 --- .../Post/Embed/StandardSiteEmbed/index.tsx | 7 ------- src/view/com/posts/PostFeed.tsx | 13 +++++++++++++ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/components/Post/Embed/StandardSiteEmbed/index.tsx b/src/components/Post/Embed/StandardSiteEmbed/index.tsx index 2c38f3806f..2bee7da91e 100644 --- a/src/components/Post/Embed/StandardSiteEmbed/index.tsx +++ b/src/components/Post/Embed/StandardSiteEmbed/index.tsx @@ -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 ( >(new Set()) const seenPostUrisRef = useRef>(new Set()) + const seenStandardSiteUrisRef = useRef>(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++) {