about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorHailey <me@haileyok.com>2025-01-26 15:40:02 -0800
committerGitHub <noreply@github.com>2025-01-26 15:40:02 -0800
commitebb6d5cc0f8179a5d1b9b71fc5ea4a64fcb4baee (patch)
tree48bf149cc57c94e3e249b77476f7cf1878d7e41c /src
parent355c50fc0fe97feb8b4ec4e29d47b725252088c7 (diff)
downloadvoidsky-ebb6d5cc0f8179a5d1b9b71fc5ea4a64fcb4baee.tar.zst
env var tweaks (#7457)
* add new events

* Discard changes to package.json

* Discard changes to src/lib/constants.ts

* Discard changes to src/state/feed-feedback.tsx

* Discard changes to yarn.lock

* remove unused event
Diffstat (limited to 'src')
-rw-r--r--src/components/FeedInterstitials.tsx25
-rw-r--r--src/components/ProfileCard.tsx3
-rw-r--r--src/lib/statsig/events.ts21
-rw-r--r--src/state/queries/suggested-follows.ts2
-rw-r--r--src/view/com/profile/FollowButton.tsx3
-rw-r--r--src/view/com/profile/ProfileCard.tsx8
-rw-r--r--src/view/screens/Search/Explore.tsx20
7 files changed, 76 insertions, 6 deletions
diff --git a/src/components/FeedInterstitials.tsx b/src/components/FeedInterstitials.tsx
index 268a5ff5b..926d27baa 100644
--- a/src/components/FeedInterstitials.tsx
+++ b/src/components/FeedInterstitials.tsx
@@ -196,6 +196,7 @@ export function SuggestedFollowsProfile({did}: {did: string}) {
     <ProfileGrid
       isSuggestionsLoading={isSuggestionsLoading}
       profiles={data?.suggestions ?? []}
+      recId={data?.recId}
       error={error}
       viewContext="profile"
     />
@@ -222,10 +223,12 @@ export function ProfileGrid({
   isSuggestionsLoading,
   error,
   profiles,
+  recId,
   viewContext = 'feed',
 }: {
   isSuggestionsLoading: boolean
   profiles: AppBskyActorDefs.ProfileViewDetailed[]
+  recId?: number
   error: Error | null
   viewContext: 'profile' | 'feed'
 }) {
@@ -249,12 +252,19 @@ export function ProfileGrid({
       ))
   ) : error || !profiles.length ? null : (
     <>
-      {profiles.slice(0, maxLength).map(profile => (
+      {profiles.slice(0, maxLength).map((profile, index) => (
         <ProfileCard.Link
           key={profile.did}
           profile={profile}
           onPress={() => {
-            logEvent('feed:interstitial:profileCard:press', {})
+            logEvent('suggestedUser:press', {
+              logContext:
+                viewContext === 'feed'
+                  ? 'InterstitialDiscover'
+                  : 'InterstitialProfile',
+              recId,
+              position: index,
+            })
           }}
           style={[
             a.flex_1,
@@ -282,6 +292,17 @@ export function ProfileGrid({
                     logContext="FeedInterstitial"
                     shape="round"
                     colorInverted
+                    onFollow={() => {
+                      logEvent('suggestedUser:follow', {
+                        logContext:
+                          viewContext === 'feed'
+                            ? 'InterstitialDiscover'
+                            : 'InterstitialProfile',
+                        location: 'Card',
+                        recId,
+                        position: index,
+                      })
+                    }}
                   />
                 </ProfileCard.Header>
                 <ProfileCard.Description profile={profile} numberOfLines={2} />
diff --git a/src/components/ProfileCard.tsx b/src/components/ProfileCard.tsx
index 7bec14b9c..78d86ab36 100644
--- a/src/components/ProfileCard.tsx
+++ b/src/components/ProfileCard.tsx
@@ -286,6 +286,7 @@ export type FollowButtonProps = {
   logContext: LogEvents['profile:follow']['logContext'] &
     LogEvents['profile:unfollow']['logContext']
   colorInverted?: boolean
+  onFollow?: () => void
 } & Partial<ButtonProps>
 
 export function FollowButton(props: FollowButtonProps) {
@@ -299,6 +300,7 @@ export function FollowButtonInner({
   moderationOpts,
   logContext,
   onPress: onPressProp,
+  onFollow,
   colorInverted,
   ...rest
 }: FollowButtonProps) {
@@ -325,6 +327,7 @@ export function FollowButtonInner({
         ),
       )
       onPressProp?.(e)
+      onFollow?.()
     } catch (err: any) {
       if (err?.name !== 'AbortError') {
         Toast.show(_(msg`An issue occurred, please try again.`), 'xmark')
diff --git a/src/lib/statsig/events.ts b/src/lib/statsig/events.ts
index 189153a10..2014f31f5 100644
--- a/src/lib/statsig/events.ts
+++ b/src/lib/statsig/events.ts
@@ -170,6 +170,26 @@ export type LogEvents = {
       | 'PostOnboardingFindFollows'
       | 'ImmersiveVideo'
   }
+  'suggestedUser:follow': {
+    logContext:
+      | 'Explore'
+      | 'InterstitialDiscover'
+      | 'InterstitialProfile'
+      | 'Profile'
+    location: 'Card' | 'Profile'
+    recId?: number
+    position: number
+  }
+  'suggestedUser:press': {
+    logContext: 'Explore' | 'InterstitialDiscover' | 'InterstitialProfile'
+    recId?: number
+    position: number
+  }
+  'suggestedUser:seen': {
+    logContext: 'Explore' | 'InterstitialDiscover' | 'InterstitialProfile'
+    recId?: number
+    position: number
+  }
   'profile:unfollow': {
     logContext:
       | 'RecommendedFollowsItem'
@@ -225,7 +245,6 @@ export type LogEvents = {
     domain: string
   }
 
-  'feed:interstitial:profileCard:press': {}
   'feed:interstitial:feedCard:press': {}
 
   'profile:header:suggestedFollowsCard:press': {}
diff --git a/src/state/queries/suggested-follows.ts b/src/state/queries/suggested-follows.ts
index 22033c0a8..0a2343150 100644
--- a/src/state/queries/suggested-follows.ts
+++ b/src/state/queries/suggested-follows.ts
@@ -120,7 +120,7 @@ export function useSuggestedFollowsByActorQuery({
       const suggestions = res.data.isFallback
         ? []
         : res.data.suggestions.filter(profile => !profile.viewer?.following)
-      return {suggestions}
+      return {suggestions, recId: res.data.recId}
     },
     enabled,
   })
diff --git a/src/view/com/profile/FollowButton.tsx b/src/view/com/profile/FollowButton.tsx
index c2d76316e..ff58dc945 100644
--- a/src/view/com/profile/FollowButton.tsx
+++ b/src/view/com/profile/FollowButton.tsx
@@ -14,12 +14,14 @@ export function FollowButton({
   profile,
   labelStyle,
   logContext,
+  onFollow,
 }: {
   unfollowedType?: ButtonType
   followedType?: ButtonType
   profile: Shadow<AppBskyActorDefs.ProfileViewBasic>
   labelStyle?: StyleProp<TextStyle>
   logContext: 'ProfileCard' | 'StarterPackProfilesList'
+  onFollow?: () => void
 }) {
   const [queueFollow, queueUnfollow] = useProfileFollowMutationQueue(
     profile,
@@ -30,6 +32,7 @@ export function FollowButton({
   const onPressFollow = async () => {
     try {
       await queueFollow()
+      onFollow?.()
     } catch (e: any) {
       if (e?.name !== 'AbortError') {
         Toast.show(_(msg`An issue occurred, please try again.`), 'xmark')
diff --git a/src/view/com/profile/ProfileCard.tsx b/src/view/com/profile/ProfileCard.tsx
index eab8611dd..f710d7b4e 100644
--- a/src/view/com/profile/ProfileCard.tsx
+++ b/src/view/com/profile/ProfileCard.tsx
@@ -184,6 +184,7 @@ export function ProfileCardWithFollowBtn({
   noBg,
   noBorder,
   onPress,
+  onFollow,
   logContext = 'ProfileCard',
   showKnownFollowers,
 }: {
@@ -191,6 +192,7 @@ export function ProfileCardWithFollowBtn({
   noBg?: boolean
   noBorder?: boolean
   onPress?: () => void
+  onFollow?: () => void
   logContext?: 'ProfileCard' | 'StarterPackProfilesList'
   showKnownFollowers?: boolean
 }) {
@@ -206,7 +208,11 @@ export function ProfileCardWithFollowBtn({
         isMe
           ? undefined
           : profileShadow => (
-              <FollowButton profile={profileShadow} logContext={logContext} />
+              <FollowButton
+                profile={profileShadow}
+                logContext={logContext}
+                onFollow={onFollow}
+              />
             )
       }
       onPress={onPress}
diff --git a/src/view/screens/Search/Explore.tsx b/src/view/screens/Search/Explore.tsx
index c5af9607b..520e103a4 100644
--- a/src/view/screens/Search/Explore.tsx
+++ b/src/view/screens/Search/Explore.tsx
@@ -10,6 +10,7 @@ import {
 import {msg, Trans} from '@lingui/macro'
 import {useLingui} from '@lingui/react'
 
+import {logEvent} from '#/lib/statsig/statsig'
 import {cleanError} from '#/lib/strings/errors'
 import {logger} from '#/logger'
 import {isNative, isWeb} from '#/platform/detection'
@@ -259,6 +260,7 @@ type ExploreScreenItems =
       type: 'profile'
       key: string
       profile: AppBskyActorDefs.ProfileView
+      recId?: number
     }
   | {
       type: 'feed'
@@ -383,6 +385,7 @@ export function Explore() {
               type: 'profile',
               key: actor.did,
               profile: actor,
+              recId: page.recId,
             })
           }
         }
@@ -511,7 +514,7 @@ export function Explore() {
   ])
 
   const renderItem = React.useCallback(
-    ({item}: {item: ExploreScreenItems}) => {
+    ({item, index}: {item: ExploreScreenItems; index: number}) => {
       switch (item.type) {
         case 'header': {
           return (
@@ -540,6 +543,21 @@ export function Explore() {
                 noBg
                 noBorder
                 showKnownFollowers
+                onPress={() => {
+                  logEvent('suggestedUser:press', {
+                    logContext: 'Explore',
+                    recId: item.recId,
+                    position: index,
+                  })
+                }}
+                onFollow={() => {
+                  logEvent('suggestedUser:follow', {
+                    logContext: 'Explore',
+                    location: 'Card',
+                    recId: item.recId,
+                    position: index,
+                  })
+                }}
               />
             </View>
           )