Implement posthog

This commit is contained in:
2025-07-06 14:02:22 +03:00
parent f7d994d02e
commit 1e099d88ae
13 changed files with 209 additions and 41 deletions

View File

@@ -0,0 +1,20 @@
import { PostHog } from "posthog-node";
let client: PostHog;
export const usePosthog = () => {
const runtimeConfig = useRuntimeConfig();
client =
client ??
new PostHog(runtimeConfig.public.posthogPublicKey, {
host: runtimeConfig.public.posthogHost,
defaults: runtimeConfig.public.posthogDefaults,
});
if (process.dev) {
client.debug();
}
return client;
};