deer social fork for personal usage. but you might see a use idk. github mirror

starter pack metrics (#9116)

* starter pack metrics

* emit starterpack:add/remove user event with starterpack uri in starter pack dialog

* rename metadata field

authored by Chenyu and committed by GitHub 12e09a9b 88535625

Changed files
+20 -1
src
components
StarterPack
dialogs
logger
view
com
profile
+3
src/components/StarterPack/Wizard/WizardListCard.tsx
··· 13 13 import {DISCOVER_FEED_URI, STARTER_PACK_MAX_SIZE} from '#/lib/constants' 14 14 import {sanitizeDisplayName} from '#/lib/strings/display-names' 15 15 import {sanitizeHandle} from '#/lib/strings/handles' 16 + import {logger} from '#/logger' 16 17 import {useSession} from '#/state/session' 17 18 import {UserAvatar} from '#/view/com/util/UserAvatar' 18 19 import { ··· 150 151 if (profile.did === targetProfileDid) return 151 152 152 153 if (!included) { 154 + logger.metric('starterPack:addUser', {}) 153 155 dispatch({type: 'AddProfile', profile}) 154 156 } else { 157 + logger.metric('starterPack:removeUser', {}) 155 158 dispatch({type: 'RemoveProfile', profileDid: profile.did}) 156 159 } 157 160 }
+4
src/components/dialogs/StarterPackDialog.tsx
··· 11 11 12 12 import {useRequireEmailVerification} from '#/lib/hooks/useRequireEmailVerification' 13 13 import {type NavigationProp} from '#/lib/routes/types' 14 + import {logger} from '#/logger' 14 15 import {isWeb} from '#/platform/detection' 15 16 import { 16 17 invalidateActorStarterPacksWithMembershipQuery, ··· 294 295 if (!starterPack.list?.uri || isPendingRefresh) return 295 296 296 297 const listUri = starterPack.list.uri 298 + const starterPackUri = starterPack.uri 297 299 298 300 setIsPendingRefresh(true) 299 301 ··· 302 304 listUri: listUri, 303 305 actorDid: targetDid, 304 306 }) 307 + logger.metric('starterPack:addUser', {starterPack: starterPackUri}) 305 308 } else { 306 309 if (!starterPackWithMembership.listItem?.uri) { 307 310 console.error('Cannot remove: missing membership URI') ··· 313 316 actorDid: targetDid, 314 317 membershipUri: starterPackWithMembership.listItem.uri, 315 318 }) 319 + logger.metric('starterPack:removeUser', {starterPack: starterPackUri}) 316 320 } 317 321 } 318 322
+7
src/logger/metrics.ts
··· 326 326 | 'ChatsList' 327 327 | 'SendViaChatDialog' 328 328 } 329 + 'starterPack:addUser': { 330 + starterPack?: string 331 + } 332 + 'starterPack:removeUser': { 333 + starterPack?: string 334 + } 329 335 'starterPack:share': { 330 336 starterPack: string 331 337 shareType: 'link' | 'qrcode' ··· 357 363 'feed:interstitial:feedCard:press': {} 358 364 359 365 'profile:header:suggestedFollowsCard:press': {} 366 + 'profile:addToStarterPack': {} 360 367 361 368 'test:all:always': {} 362 369 'test:all:sometimes': {}
+6 -1
src/view/com/profile/ProfileMenu.tsx
··· 105 105 }) 106 106 }, [queryClient, profile.did]) 107 107 108 + const onPressAddToStarterPacks = React.useCallback(() => { 109 + logger.metric('profile:addToStarterPack', {}) 110 + addToStarterPacksDialogControl.open() 111 + }, [addToStarterPacksDialogControl]) 112 + 108 113 const onPressShare = React.useCallback(() => { 109 114 shareUrl(toShareUrl(makeProfileLink(profile))) 110 115 }, [profile]) ··· 306 311 <Menu.Item 307 312 testID="profileHeaderDropdownStarterPackAddRemoveBtn" 308 313 label={_(msg`Add to starter packs`)} 309 - onPress={addToStarterPacksDialogControl.open}> 314 + onPress={onPressAddToStarterPacks}> 310 315 <Menu.ItemText> 311 316 <Trans>Add to starter packs</Trans> 312 317 </Menu.ItemText>