Implement posthog
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { chain, draw, get, isEmpty, omit, pick, tryit } from "radash";
|
||||
import { chain, draw, get, isEmpty, omit, tryit } from "radash";
|
||||
import { safeDestr } from "destr";
|
||||
import { match } from "ts-pattern";
|
||||
import { User } from "./drizzle";
|
||||
@@ -191,6 +191,10 @@ export const createActivityContent = async ({
|
||||
const stravaRequestBody = {
|
||||
name: responseObject!.title,
|
||||
description: responseObject!.description,
|
||||
meta: {
|
||||
highlight,
|
||||
tone,
|
||||
},
|
||||
};
|
||||
|
||||
return [aiError || parseError, stravaRequestBody] as const;
|
||||
|
||||
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