Skip to content

Commit

Permalink
chore: add profile id to mixpanel (#761)
Browse files Browse the repository at this point in the history
  • Loading branch information
bigint committed Oct 8, 2022
1 parent b83f6d9 commit 8381139
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/components/Profile/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,20 @@ const ViewProfile: NextPage = () => {
: 'FEED'
);

useEffect(() => {
Mixpanel.track('Pageview', { path: PAGEVIEW.PROFILE });
}, []);

const { data, loading, error } = useQuery(ProfileDocument, {
variables: { request: { handle: username }, who: currentProfile?.id ?? null },
skip: !username
});

useEffect(() => {
if (data?.profile?.id) {
Mixpanel.track('Pageview', {
path: PAGEVIEW.PROFILE,
id: data.profile.id
});
}
}, [data]);

if (error) {
return <Custom500 />;
}
Expand Down

1 comment on commit 8381139

@vercel
Copy link

@vercel vercel bot commented on 8381139 Oct 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.