mirror of
https://github.com/documenso/documenso.git
synced 2025-11-25 14:11:43 +10:00
fix: rework sessions
This commit is contained in:
@ -3,7 +3,6 @@ import { useEffect } from 'react';
|
||||
import posthog from 'posthog-js';
|
||||
import { useLocation, useSearchParams } from 'react-router';
|
||||
|
||||
import { useOptionalSession } from '@documenso/lib/client-only/providers/session';
|
||||
import { extractPostHogConfig } from '@documenso/lib/constants/feature-flags';
|
||||
|
||||
export function PostHogPageview() {
|
||||
@ -12,19 +11,20 @@ export function PostHogPageview() {
|
||||
const { pathname } = useLocation();
|
||||
const [searchParams] = useSearchParams();
|
||||
|
||||
const { user } = useOptionalSession();
|
||||
// const { sessionData } = useOptionalSession();
|
||||
// const user = sessionData?.user;
|
||||
|
||||
if (typeof window !== 'undefined' && postHogConfig) {
|
||||
posthog.init(postHogConfig.key, {
|
||||
api_host: postHogConfig.host,
|
||||
disable_session_recording: true,
|
||||
loaded: () => {
|
||||
if (user) {
|
||||
posthog.identify(user.email ?? user.id.toString());
|
||||
} else {
|
||||
posthog.reset();
|
||||
}
|
||||
},
|
||||
// loaded: () => {
|
||||
// if (user) {
|
||||
// posthog.identify(user.email ?? user.id.toString());
|
||||
// } else {
|
||||
// posthog.reset();
|
||||
// }
|
||||
// },
|
||||
custom_campaign_params: ['src'],
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user