diff --git a/app/src/components/Analytics.tsx b/app/src/components/Analytics.tsx index 8b829527b..d5053d554 100644 --- a/app/src/components/Analytics.tsx +++ b/app/src/components/Analytics.tsx @@ -11,6 +11,9 @@ import { AnalyticsQuery } from '~/api/__generated__/AnalyticsQuery.graphql'; ampli.load({ client: { apiKey: CONFIG.amplitudeKey, + configuration: { + trackingSessionEvents: true, + }, }, }); @@ -19,6 +22,9 @@ const Query = graphql` user { id } + accounts { + address + } } `; @@ -29,12 +35,16 @@ export function Analytics() { const previousPathname = useRef(); - const userId = useLazyQuery(Query, {}).user.id; + const { user, accounts } = useLazyQuery(Query, {}); useEffect(() => { - ampli.identify(userId, { device_id: approver }); Sentry.setUser({ id: approver }); - }, [approver, userId]); + ampli.identify(user.id, { device_id: approver }); + ampli.client.setGroup( + 'account', + accounts.map((a) => a.address), + ); + }, [approver, user.id, accounts]); useEffect(() => { ampli.screenView({