starter pack metrics (#9116)
* starter pack metrics * emit starterpack:add/remove user event with starterpack uri in starter pack dialog * rename metadata field
This commit is contained in:
@@ -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})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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': {}
|
||||
|
||||
@@ -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 = ({
|
||||
<Menu.Item
|
||||
testID="profileHeaderDropdownStarterPackAddRemoveBtn"
|
||||
label={_(msg`Add to starter packs`)}
|
||||
onPress={addToStarterPacksDialogControl.open}>
|
||||
onPress={onPressAddToStarterPacks}>
|
||||
<Menu.ItemText>
|
||||
<Trans>Add to starter packs</Trans>
|
||||
</Menu.ItemText>
|
||||
|
||||
Reference in New Issue
Block a user