diff --git a/src/lib/statsig/events.ts b/src/lib/statsig/events.ts index f1dfb0a947..aeb6879373 100644 --- a/src/lib/statsig/events.ts +++ b/src/lib/statsig/events.ts @@ -236,4 +236,9 @@ export type LogEvents = { 'tmd:share': {} 'tmd:download': {} 'tmd:post': {} + + 'trendingTopics:show': {} + 'trendingTopics:hide': { + context: 'sidebar' | 'discover' | 'explore' + } } diff --git a/src/state/preferences/trending.tsx b/src/state/preferences/trending.tsx index bf5d8f13cc..96d453c080 100644 --- a/src/state/preferences/trending.tsx +++ b/src/state/preferences/trending.tsx @@ -1,5 +1,6 @@ import React from 'react' +import {logEvent} from '#/lib/statsig/statsig' import * as persisted from '#/state/persisted' type StateContext = { @@ -26,7 +27,11 @@ function usePersistedBooleanValue(key: T) { (value: Exclude) => void >( hidden => { - _set(Boolean(hidden)) + const hide = Boolean(hidden) + if (!hide) { + logEvent('trendingTopics:show', {}) + } + _set(hide) persisted.write(key, hidden) }, [key, _set],