[Explore] Add index to view metric (#8124)

* add index to view metric

* supply index

* always return a number
This commit is contained in:
Samuel Newman
2025-04-04 18:24:26 +03:00
committed by GitHub
parent ceb51c7e8f
commit 0004e27427
2 changed files with 3 additions and 2 deletions
+1
View File
@@ -330,6 +330,7 @@ export type MetricEvents = {
| 'suggestedFeeds'
| 'suggestedStarterPacks'
| `feed:${FeedDescriptor}`
index: number
}
'explore:module:searchButtonPress': {
module: 'suggestedAccounts' | 'suggestedFeeds'
+2 -2
View File
@@ -888,7 +888,7 @@ export function Explore({
viewableItems: ViewToken<ExploreScreenItems>[]
changed: ViewToken<ExploreScreenItems>[]
}) => {
for (const {item} of viewableItems.filter(vi => vi.isViewable)) {
for (const {item, index} of viewableItems.filter(vi => vi.isViewable)) {
let module: MetricEvents['explore:module:seen']['module']
if (item.type === 'trendingTopics' || item.type === 'trendingVideos') {
module = item.type
@@ -905,7 +905,7 @@ export function Explore({
}
if (!alreadyReportedRef.current.has(module)) {
alreadyReportedRef.current.set(module, module)
logger.metric('explore:module:seen', {module})
logger.metric('explore:module:seen', {module, index: index ?? -1})
}
}
},