diff --git a/src/components/StarterPack/Wizard/WizardListCard.tsx b/src/components/StarterPack/Wizard/WizardListCard.tsx index 4b74311577..089092636d 100644 --- a/src/components/StarterPack/Wizard/WizardListCard.tsx +++ b/src/components/StarterPack/Wizard/WizardListCard.tsx @@ -13,6 +13,7 @@ import {useLingui} from '@lingui/react' import {DISCOVER_FEED_URI, STARTER_PACK_MAX_SIZE} from '#/lib/constants' import {sanitizeDisplayName} from '#/lib/strings/display-names' import {sanitizeHandle} from '#/lib/strings/handles' +import {logger} from '#/logger' import {useSession} from '#/state/session' import {UserAvatar} from '#/view/com/util/UserAvatar' import { @@ -150,8 +151,10 @@ export function WizardProfileCard({ if (profile.did === targetProfileDid) return if (!included) { + logger.metric('starterPack:addUser', {}) dispatch({type: 'AddProfile', profile}) } else { + logger.metric('starterPack:removeUser', {}) dispatch({type: 'RemoveProfile', profileDid: profile.did}) } } diff --git a/src/components/dialogs/StarterPackDialog.tsx b/src/components/dialogs/StarterPackDialog.tsx index 78f47b199a..ae225a0d1d 100644 --- a/src/components/dialogs/StarterPackDialog.tsx +++ b/src/components/dialogs/StarterPackDialog.tsx @@ -11,6 +11,7 @@ import {useQueryClient} from '@tanstack/react-query' import {useRequireEmailVerification} from '#/lib/hooks/useRequireEmailVerification' import {type NavigationProp} from '#/lib/routes/types' +import {logger} from '#/logger' import {isWeb} from '#/platform/detection' import { invalidateActorStarterPacksWithMembershipQuery, @@ -294,6 +295,7 @@ function StarterPackItem({ if (!starterPack.list?.uri || isPendingRefresh) return const listUri = starterPack.list.uri + const starterPackUri = starterPack.uri setIsPendingRefresh(true) @@ -302,6 +304,7 @@ function StarterPackItem({ listUri: listUri, actorDid: targetDid, }) + logger.metric('starterPack:addUser', {starterPack: starterPackUri}) } else { if (!starterPackWithMembership.listItem?.uri) { console.error('Cannot remove: missing membership URI') @@ -313,6 +316,7 @@ function StarterPackItem({ actorDid: targetDid, membershipUri: starterPackWithMembership.listItem.uri, }) + logger.metric('starterPack:removeUser', {starterPack: starterPackUri}) } } diff --git a/src/logger/metrics.ts b/src/logger/metrics.ts index f2c56d9638..2ac4202718 100644 --- a/src/logger/metrics.ts +++ b/src/logger/metrics.ts @@ -326,6 +326,12 @@ export type MetricEvents = { | 'ChatsList' | 'SendViaChatDialog' } + 'starterPack:addUser': { + starterPack?: string + } + 'starterPack:removeUser': { + starterPack?: string + } 'starterPack:share': { starterPack: string shareType: 'link' | 'qrcode' @@ -357,6 +363,7 @@ export type MetricEvents = { 'feed:interstitial:feedCard:press': {} 'profile:header:suggestedFollowsCard:press': {} + 'profile:addToStarterPack': {} 'test:all:always': {} 'test:all:sometimes': {} diff --git a/src/view/com/profile/ProfileMenu.tsx b/src/view/com/profile/ProfileMenu.tsx index df8b2e4817..c065b2d1f8 100644 --- a/src/view/com/profile/ProfileMenu.tsx +++ b/src/view/com/profile/ProfileMenu.tsx @@ -105,6 +105,11 @@ let ProfileMenu = ({ }) }, [queryClient, profile.did]) + const onPressAddToStarterPacks = React.useCallback(() => { + logger.metric('profile:addToStarterPack', {}) + addToStarterPacksDialogControl.open() + }, [addToStarterPacksDialogControl]) + const onPressShare = React.useCallback(() => { shareUrl(toShareUrl(makeProfileLink(profile))) }, [profile]) @@ -306,7 +311,7 @@ let ProfileMenu = ({