Skip to content

Commit

Permalink
Fix posthog identify and clear on logout (#1029)
Browse files Browse the repository at this point in the history
  • Loading branch information
tarrencev authored Nov 14, 2024
1 parent 9b0e187 commit bde9cc1
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions packages/keychain/src/hooks/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,18 @@ export function useConnectionValue() {
}, [context, parent]);

const setController = useCallback((controller?: Controller) => {
posthog.identify(controller.cartridge.username(), {
address: controller.address,
class: controller.cartridge.classHash,
chainId: controller.chainId,
appId: origin,
});
posthog.group("company", origin);
if (controller && controller.cartridge) {
posthog.identify(controller.cartridge.username(), {
address: controller.address,
class: controller.cartridge.classHash,
chainId: controller.chainId,
appId: origin,
});

posthog.group("company", origin);
} else {
posthog.reset();
}

setControllerRaw(controller);
setIsSignedUp();
Expand Down

0 comments on commit bde9cc1

Please sign in to comment.