Skip to content

Commit

Permalink
Add more info in the identify call
Browse files Browse the repository at this point in the history
  • Loading branch information
lukevella committed Jul 21, 2024
1 parent 49a06f1 commit 12e8e39
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions apps/web/src/contexts/posthog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { PostHogProvider as Provider, usePostHog } from "posthog-js/react";
import React from "react";
import { useMount } from "react-use";

import { useTranslation } from "@/app/i18n/client";
import { useUser } from "@/components/user-provider";
import { env } from "@/env";

Expand Down Expand Up @@ -48,13 +49,18 @@ function usePostHogPageView() {

export function PostHogProvider(props: PostHogProviderProps) {
const { user } = useUser();
const { i18n } = useTranslation();

usePostHogPageView();

useMount(() => {
if (user.email) {
posthog.identify(user.id, {
email: user.email,
name: user.name,
tier: user.tier,
timeZone: user.timeZone,
locale: i18n.language,
});
}
});
Expand Down

0 comments on commit 12e8e39

Please sign in to comment.