diff options
author | dan <dan.abramov@gmail.com> | 2024-04-08 18:38:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-08 18:38:51 +0100 |
commit | 887fedabeaa3470615199642870494df2784b280 (patch) | |
tree | 0b702fe146e55bceae6b5e213887e565f23cd54a /src/lib/statsig/statsig.tsx | |
parent | 8188f61e7dae70742f05d7a9535983dec8ddee8c (diff) | |
download | voidsky-887fedabeaa3470615199642870494df2784b280.tar.zst |
[Statsig] Track like/follow metadata (#3435)
* Track becoming mutuals * Track poster/liker status * Track post and followee clout * Track follower and liker clout * Extract utility
Diffstat (limited to 'src/lib/statsig/statsig.tsx')
-rw-r--r-- | src/lib/statsig/statsig.tsx | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/lib/statsig/statsig.tsx b/src/lib/statsig/statsig.tsx index d0ef2408e..c16461621 100644 --- a/src/lib/statsig/statsig.tsx +++ b/src/lib/statsig/statsig.tsx @@ -43,6 +43,14 @@ export function attachRouteToLogEvents( getCurrentRouteName = getRouteName } +export function toClout(n: number | null | undefined): number | undefined { + if (n == null) { + return undefined + } else { + return Math.max(0, Math.round(Math.log(n))) + } +} + export function logEvent<E extends keyof LogEvents>( eventName: E & string, rawMetadata: LogEvents[E] & FlatJSONRecord, |