Implement posthog
This commit is contained in:
20
server/utils/posthog-client.ts
Normal file
20
server/utils/posthog-client.ts
Normal 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;
|
||||
};
|
||||
Reference in New Issue
Block a user