diff --git a/docs/package.json b/docs/package.json index b2b74aba7..dddb88b04 100644 --- a/docs/package.json +++ b/docs/package.json @@ -36,6 +36,7 @@ "path": "^0.12.7", "plop": "^4.0.1", "plop-helper-date": "^1.0.0", + "posthog-js": "^1.186.3", "react": "^18", "react-dom": "^18", "react-hook-form": "^7.51.1", diff --git a/web/app/layout.tsx b/web/app/layout.tsx index 5f14d6f5c..29c44f19e 100644 --- a/web/app/layout.tsx +++ b/web/app/layout.tsx @@ -4,6 +4,8 @@ import { Metadata } from 'next' import '@/styles/main.scss' +import { CSPostHogProvider } from './posthog' + export const metadata: Metadata = { title: 'Jan', description: @@ -13,10 +15,12 @@ export const metadata: Metadata = { export default function RootLayout({ children }: PropsWithChildren) { return ( - -
- {children} - + + +
+ {children} + + ) } diff --git a/web/app/posthog.js b/web/app/posthog.js new file mode 100644 index 000000000..d6a6bf0bb --- /dev/null +++ b/web/app/posthog.js @@ -0,0 +1,14 @@ +'use client' + +import posthog from 'posthog-js' +import { PostHogProvider } from 'posthog-js/react' + +if (typeof window !== 'undefined') { + posthog.init(process.env.NEXT_PUBLIC_POSTHOG_KEY, { + api_host: process.env.NEXT_PUBLIC_POSTHOG_HOST, + person_profiles: 'identified_only', // or 'always' to create profiles for anonymous users as well + }) +} +export function CSPostHogProvider({ children }) { + return {children} +}