feat: initial setup posthog
This commit is contained in:
parent
b046ee3e22
commit
655a4a159a
@ -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",
|
||||
|
||||
@ -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 (
|
||||
<html lang="en" suppressHydrationWarning>
|
||||
<CSPostHogProvider>
|
||||
<body className="h-screen font-sans text-sm antialiased">
|
||||
<div className="dragable-bar" />
|
||||
{children}
|
||||
</body>
|
||||
</CSPostHogProvider>
|
||||
</html>
|
||||
)
|
||||
}
|
||||
|
||||
14
web/app/posthog.js
Normal file
14
web/app/posthog.js
Normal file
@ -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 <PostHogProvider client={posthog}>{children}</PostHogProvider>
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user