diff options
author | dan <dan.abramov@gmail.com> | 2024-03-20 03:24:05 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-19 20:24:05 -0700 |
commit | 3d8d1dd1737c11d924bec7d51ae4deb6cb6336b0 (patch) | |
tree | adb96f24141561ba4adfd818e179b0c5c0d2bff1 /src/lib/hooks | |
parent | 2e2fae378af09682370e9b4ebf59d32cae1b848c (diff) | |
download | voidsky-3d8d1dd1737c11d924bec7d51ae4deb6cb6336b0.tar.zst |
[Statsig] Track login/logout (#3286)
* [Statsig] Track login/logout * Fix missing attribution
Diffstat (limited to 'src/lib/hooks')
-rw-r--r-- | src/lib/hooks/useAccountSwitcher.ts | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/lib/hooks/useAccountSwitcher.ts b/src/lib/hooks/useAccountSwitcher.ts index 74b5674d5..eb1685a0a 100644 --- a/src/lib/hooks/useAccountSwitcher.ts +++ b/src/lib/hooks/useAccountSwitcher.ts @@ -6,6 +6,7 @@ import {useSessionApi, SessionAccount} from '#/state/session' import * as Toast from '#/view/com/util/Toast' import {useCloseAllActiveElements} from '#/state/util' import {useLoggedOutViewControls} from '#/state/shell/logged-out' +import {LogEvents} from '../statsig/statsig' export function useAccountSwitcher() { const {track} = useAnalytics() @@ -14,7 +15,10 @@ export function useAccountSwitcher() { const {requestSwitchToAccount} = useLoggedOutViewControls() const onPressSwitchAccount = useCallback( - async (account: SessionAccount) => { + async ( + account: SessionAccount, + logContext: LogEvents['account:loggedIn']['logContext'], + ) => { track('Settings:SwitchAccountButtonClicked') try { @@ -28,7 +32,7 @@ export function useAccountSwitcher() { // So we change the URL ourselves. The navigator will pick it up on remount. history.pushState(null, '', '/') } - await selectAccount(account) + await selectAccount(account, logContext) setTimeout(() => { Toast.show(`Signed in as @${account.handle}`) }, 100) |