Fix posthog events

- broken due register call coming before init
This commit is contained in:
Mattias Granlund 2024-01-24 15:28:16 +01:00
parent 2f1cc069be
commit b4d56e191f

View File

@ -5,10 +5,6 @@ import { getVersion, getName } from '@tauri-apps/api/app';
export async function initPostHog() {
const [appName, appVersion] = await Promise.all([getName(), getVersion()]);
posthog.register_for_session({
appName,
appVersion
});
posthog.init(PUBLIC_POSTHOG_API_KEY, {
api_host: 'https://eu.posthog.com',
disable_session_recording: appName !== 'GitButler', // only record sessions in production
@ -19,6 +15,10 @@ export async function initPostHog() {
console.log('posthog error', e);
}
});
posthog.register({
appName,
appVersion
});
}
export function setPostHogUser(user: User) {