Bluesky app fork with some witchin' additions 💫

Some metrics (#7294)

* Add trending metrics

* Progress guide events

* Fix naming, improve existing events

authored by

Eric Bailey and committed by
GitHub
c6d26a0a 8b7a3318

+56 -14
+5 -1
src/components/ProgressGuide/FollowDialog.tsx
··· 10 10 import {useLingui} from '@lingui/react' 11 11 12 12 import {useNonReactiveCallback} from '#/lib/hooks/useNonReactiveCallback' 13 + import {logEvent} from '#/lib/statsig/statsig' 13 14 import {cleanError} from '#/lib/strings/errors' 14 15 import {logger} from '#/logger' 15 16 import {isWeb} from '#/platform/detection' ··· 75 76 <> 76 77 <Button 77 78 label={_(msg`Find people to follow`)} 78 - onPress={control.open} 79 + onPress={() => { 80 + control.open() 81 + logEvent('progressGuide:followDialog:open', {}) 82 + }} 79 83 size={gtMobile ? 'small' : 'large'} 80 84 color="primary" 81 85 variant="solid">
+6 -1
src/components/interstitials/Trending.tsx
··· 88 88 ) : !trending?.topics ? null : ( 89 89 <> 90 90 {trending.topics.map(topic => ( 91 - <TrendingTopicLink key={topic.link} topic={topic}> 91 + <TrendingTopicLink 92 + key={topic.link} 93 + topic={topic} 94 + onPress={() => { 95 + logEvent('trendingTopic:click', {context: 'interstitial'}) 96 + }}> 92 97 {({hovered}) => ( 93 98 <TrendingTopic 94 99 topic={topic}
+13 -2
src/lib/statsig/events.ts
··· 237 237 'tmd:download': {} 238 238 'tmd:post': {} 239 239 240 - 'trendingTopics:show': {} 240 + 'trendingTopics:show': { 241 + context: 'settings' 242 + } 241 243 'trendingTopics:hide': { 242 - context: 'sidebar' | 'interstitial' | 'explore:trending' 244 + context: 'settings' | 'sidebar' | 'interstitial' | 'explore:trending' 245 + } 246 + 'trendingTopic:click': { 247 + context: 'sidebar' | 'interstitial' | 'explore' 248 + } 249 + 'recommendedTopic:click': { 250 + context: 'explore' 243 251 } 252 + 253 + 'progressGuide:hide': {} 254 + 'progressGuide:followDialog:open': {} 244 255 }
+7 -1
src/screens/Search/components/ExploreRecommendations.tsx
··· 1 1 import {View} from 'react-native' 2 2 import {Trans} from '@lingui/macro' 3 3 4 + import {logEvent} from '#/lib/statsig/statsig' 4 5 import {isWeb} from '#/platform/detection' 5 6 import { 6 7 DEFAULT_LIMIT as RECOMMENDATIONS_COUNT, ··· 71 72 ) : !trending?.suggested ? null : ( 72 73 <> 73 74 {trending.suggested.map(topic => ( 74 - <TrendingTopicLink key={topic.link} topic={topic}> 75 + <TrendingTopicLink 76 + key={topic.link} 77 + topic={topic} 78 + onPress={() => { 79 + logEvent('recommendedTopic:click', {context: 'explore'}) 80 + }}> 75 81 {({hovered}) => ( 76 82 <TrendingTopic 77 83 topic={topic}
+6 -1
src/screens/Search/components/ExploreTrendingTopics.tsx
··· 106 106 ) : !trending?.topics ? null : ( 107 107 <> 108 108 {trending.topics.map(topic => ( 109 - <TrendingTopicLink key={topic.link} topic={topic}> 109 + <TrendingTopicLink 110 + key={topic.link} 111 + topic={topic} 112 + onPress={() => { 113 + logEvent('trendingTopic:click', {context: 'explore'}) 114 + }}> 110 115 {({hovered}) => ( 111 116 <TrendingTopic 112 117 topic={topic}
+10 -1
src/screens/Settings/ContentAndMediaSettings.tsx
··· 3 3 import {NativeStackScreenProps} from '@react-navigation/native-stack' 4 4 5 5 import {CommonNavigatorParams} from '#/lib/routes/types' 6 + import {logEvent} from '#/lib/statsig/statsig' 6 7 import {isNative} from '#/platform/detection' 7 8 import {useAutoplayDisabled, useSetAutoplayDisabled} from '#/state/preferences' 8 9 import { ··· 120 121 name="show_trending_topics" 121 122 label={_(msg`Enable trending topics`)} 122 123 value={!trendingDisabled} 123 - onChange={value => setTrendingDisabled(!value)}> 124 + onChange={value => { 125 + const hide = Boolean(!value) 126 + if (hide) { 127 + logEvent('trendingTopics:hide', {context: 'settings'}) 128 + } else { 129 + logEvent('trendingTopics:show', {context: 'settings'}) 130 + } 131 + setTrendingDisabled(hide) 132 + }}> 124 133 <SettingsList.Item> 125 134 <SettingsList.ItemIcon icon={Graph} /> 126 135 <SettingsList.ItemText>
+1 -6
src/state/preferences/trending.tsx
··· 1 1 import React from 'react' 2 2 3 - import {logEvent} from '#/lib/statsig/statsig' 4 3 import * as persisted from '#/state/persisted' 5 4 6 5 type StateContext = { ··· 27 26 (value: Exclude<persisted.Schema[T], undefined>) => void 28 27 >( 29 28 hidden => { 30 - const hide = Boolean(hidden) 31 - if (!hide) { 32 - logEvent('trendingTopics:show', {}) 33 - } 34 - _set(hide) 29 + _set(Boolean(hidden)) 35 30 persisted.write(key, hidden) 36 31 }, 37 32 [key, _set],
+2
src/state/shell/progress-guide.tsx
··· 2 2 import {msg} from '@lingui/macro' 3 3 import {useLingui} from '@lingui/react' 4 4 5 + import {logEvent} from '#/lib/statsig/statsig' 5 6 import { 6 7 ProgressGuideToast, 7 8 ProgressGuideToastRef, ··· 137 138 endProgressGuide() { 138 139 setLocalGuideState(undefined) 139 140 mutateAsync(undefined) 141 + logEvent('progressGuide:hide', {}) 140 142 }, 141 143 142 144 captureAction(action: ProgressGuideAction, count = 1) {
+6 -1
src/view/shell/desktop/SidebarTrendingTopics.tsx
··· 79 79 ) : !trending?.topics ? null : ( 80 80 <> 81 81 {trending.topics.slice(0, TRENDING_LIMIT).map(topic => ( 82 - <TrendingTopicLink key={topic.link} topic={topic}> 82 + <TrendingTopicLink 83 + key={topic.link} 84 + topic={topic} 85 + onPress={() => { 86 + logEvent('trendingTopic:click', {context: 'sidebar'}) 87 + }}> 83 88 {({hovered}) => ( 84 89 <TrendingTopic 85 90 size="small"