From 222954b397202b5acfb00c095d2fc520aaf1bbde Mon Sep 17 00:00:00 2001 From: DS Boyce <260543580+ds-boyce@users.noreply.github.com> Date: Wed, 25 Mar 2026 15:13:23 -0700 Subject: [PATCH] Pass correct log context to suggested user metrics (#10074) (cherry picked from commit d44060a34e5078a22eb290613de09ad1a35cd09b) --- src/analytics/metrics/types.ts | 29 +++--- src/components/FeedInterstitials.tsx | 48 ++++----- src/components/ProgressGuide/FollowDialog.tsx | 97 ++++++++++++------- 3 files changed, 98 insertions(+), 76 deletions(-) diff --git a/src/analytics/metrics/types.ts b/src/analytics/metrics/types.ts index 113bef9137..1f6b25278b 100644 --- a/src/analytics/metrics/types.ts +++ b/src/analytics/metrics/types.ts @@ -480,10 +480,12 @@ export type Events = { 'suggestedUser:follow': { logContext: | 'Explore' - | 'InterstitialDiscover' - | 'InterstitialProfile' - | 'Profile' + | 'DiscoverInterstitial' + | 'ProfileInterstitial' + | 'ProfileHeader' | 'Onboarding' + | 'SeeMoreSuggestedUsers' + | 'ProgressGuide' location: 'Card' | 'Profile' | 'FollowAll' recId?: number | string position: number @@ -493,9 +495,11 @@ export type Events = { 'suggestedUser:press': { logContext: | 'Explore' - | 'InterstitialDiscover' - | 'InterstitialProfile' + | 'DiscoverInterstitial' + | 'ProfileInterstitial' + | 'ProfileHeader' | 'Onboarding' + | 'SeeMoreSuggestedUsers' recId?: number | string position: number suggestedDid: string @@ -504,10 +508,11 @@ export type Events = { 'suggestedUser:seen': { logContext: | 'Explore' - | 'InterstitialDiscover' - | 'InterstitialProfile' - | 'Profile' + | 'DiscoverInterstitial' + | 'ProfileInterstitial' + | 'ProfileHeader' | 'Onboarding' + | 'SeeMoreSuggestedUsers' | 'ProgressGuide' recId?: number | string position: number @@ -517,14 +522,14 @@ export type Events = { 'suggestedUser:seeMore': { logContext: | 'Explore' - | 'InterstitialDiscover' - | 'InterstitialProfile' - | 'Profile' + | 'DiscoverInterstitial' + | 'ProfileInterstitial' + | 'ProfileHeader' | 'Onboarding' recId?: number | string } 'suggestedUser:dismiss': { - logContext: 'InterstitialDiscover' | 'InterstitialProfile' + logContext: 'DiscoverInterstitial' | 'ProfileInterstitial' | 'ProfileHeader' recId?: number | string position: number suggestedDid: string diff --git a/src/components/FeedInterstitials.tsx b/src/components/FeedInterstitials.tsx index af73d904b7..645b90a4f6 100644 --- a/src/components/FeedInterstitials.tsx +++ b/src/components/FeedInterstitials.tsx @@ -8,9 +8,7 @@ import Animated, { LinearTransition, } from 'react-native-reanimated' import {type AppBskyFeedDefs, AtUri} from '@atproto/api' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' -import {Trans} from '@lingui/react/macro' +import {Trans, useLingui} from '@lingui/react/macro' import {useNavigation} from '@react-navigation/native' import {type NavigationProp} from '#/lib/routes/types' @@ -295,7 +293,7 @@ export function ProfileGrid({ }) { const t = useTheme() const ax = useAnalytics() - const {_} = useLingui() + const {t: l} = useLingui() const moderationOpts = useModerationOpts() const {gtMobile} = useBreakpoints() const followDialogControl = useDialogControl() @@ -312,10 +310,10 @@ export function ProfileGrid({ const containerRef = useRef(null) const hasTrackedRef = useRef(false) const logContext: Metrics['suggestedUser:seen']['logContext'] = isFeedContext - ? 'InterstitialDiscover' + ? 'DiscoverInterstitial' : isProfileHeaderContext - ? 'Profile' - : 'InterstitialProfile' + ? 'ProfileHeader' + : 'ProfileInterstitial' // Callback to fire seen events const fireSeen = useCallback(() => { @@ -336,7 +334,7 @@ export function ProfileGrid({ }) } }) - }, [ax, isLoading, error, profiles, maxLength, logContext]) + }, [isLoading, error, profiles, maxLength, ax, logContext]) // For profile header, fire when isVisible becomes true useEffect(() => { @@ -424,9 +422,7 @@ export function ProfileGrid({ profile={profile.actor} onPress={() => { ax.metric('suggestedUser:press', { - logContext: isFeedContext - ? 'InterstitialDiscover' - : 'InterstitialProfile', + logContext, recId: profile.recId, position: index, suggestedDid: profile.actor.did, @@ -442,14 +438,12 @@ export function ProfileGrid({ {onDismiss && ( )} - - {gtMobile ? ( @@ -620,7 +610,7 @@ export function ProfileGrid({ onPress={() => { followDialogControl.open() ax.metric('suggestedUser:seeMore', { - logContext: 'Explore', + logContext, }) }} /> @@ -634,11 +624,11 @@ export function ProfileGrid({ } function SeeMoreSuggestedProfilesCard({onPress}: {onPress: () => void}) { - const {_} = useLingui() + const {t: l} = useLingui() return (