mirror of
https://github.com/lukevella/rallly.git
synced 2025-05-02 11:46:03 +02:00
📈 Switch to posthog alias for guest users
This commit is contained in:
parent
bb04eafdef
commit
2a9a2dec7d
1 changed files with 11 additions and 7 deletions
|
@ -54,6 +54,7 @@ export function PostHogProvider(props: PostHogProviderProps) {
|
||||||
usePostHogPageView();
|
usePostHogPageView();
|
||||||
|
|
||||||
useMount(() => {
|
useMount(() => {
|
||||||
|
if (user.email) {
|
||||||
posthog.identify(user.id, {
|
posthog.identify(user.id, {
|
||||||
email: user.email,
|
email: user.email,
|
||||||
name: user.name,
|
name: user.name,
|
||||||
|
@ -61,6 +62,9 @@ export function PostHogProvider(props: PostHogProviderProps) {
|
||||||
timeZone: user.timeZone,
|
timeZone: user.timeZone,
|
||||||
locale: i18n.language,
|
locale: i18n.language,
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
posthog.alias(user.id);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return <Provider client={posthog}>{props.children}</Provider>;
|
return <Provider client={posthog}>{props.children}</Provider>;
|
||||||
|
|
Loading…
Add table
Reference in a new issue