diff --git a/frontend/app/layout.tsx b/frontend/app/layout.tsx
index 50ee950..bdc4959 100644
--- a/frontend/app/layout.tsx
+++ b/frontend/app/layout.tsx
@@ -6,6 +6,7 @@ import { ThemeProvider } from "@/components/layout/themeProvider"
import { ClerkProvider } from "@clerk/nextjs"
import { Toaster } from "@/components/ui/sonner"
import { Analytics } from "@vercel/analytics/react"
+import { PHProvider } from "./providers"
export const metadata: Metadata = {
title: "Sandbox",
@@ -20,18 +21,20 @@ export default function RootLayout({
return (
-
-
- {children}
-
-
-
-
+
+
+
+ {children}
+
+
+
+
+
)
diff --git a/frontend/app/providers.js b/frontend/app/providers.js
new file mode 100644
index 0000000..8381b4c
--- /dev/null
+++ b/frontend/app/providers.js
@@ -0,0 +1,13 @@
+"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,
+ })
+}
+
+export function PHProvider({ children }) {
+ return {children}
+}
diff --git a/frontend/package-lock.json b/frontend/package-lock.json
index 0b8f3e2..b19dc1d 100644
--- a/frontend/package-lock.json
+++ b/frontend/package-lock.json
@@ -40,6 +40,7 @@
"monaco-themes": "^0.4.4",
"next": "14.1.3",
"next-themes": "^0.3.0",
+ "posthog-js": "^1.147.0",
"react": "^18.3.1",
"react-dom": "^18",
"react-hook-form": "^7.51.3",
@@ -3269,6 +3270,30 @@
"resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz",
"integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ=="
},
+ "node_modules/posthog-js": {
+ "version": "1.147.0",
+ "resolved": "https://registry.npmjs.org/posthog-js/-/posthog-js-1.147.0.tgz",
+ "integrity": "sha512-cALKIcix1W9xMsfUUI/QUFhtBeabDGsQCb3lpZEFd7WCPNLOcGmpeomm4xMX7MO2OnfK6Ov91/HNyfK1wncjSA==",
+ "dependencies": {
+ "fflate": "^0.4.8",
+ "preact": "^10.19.3",
+ "web-vitals": "^4.0.1"
+ }
+ },
+ "node_modules/posthog-js/node_modules/fflate": {
+ "version": "0.4.8",
+ "resolved": "https://registry.npmjs.org/fflate/-/fflate-0.4.8.tgz",
+ "integrity": "sha512-FJqqoDBR00Mdj9ppamLa/Y7vxm+PRmNWA67N846RvsoYVMKB4q3y/de5PA7gUmRMYK/8CMz2GDZQmCRN1wBcWA=="
+ },
+ "node_modules/preact": {
+ "version": "10.22.1",
+ "resolved": "https://registry.npmjs.org/preact/-/preact-10.22.1.tgz",
+ "integrity": "sha512-jRYbDDgMpIb5LHq3hkI0bbl+l/TQ9UnkdQ0ww+lp+4MMOdqaUYdFc5qeyP+IV8FAd/2Em7drVPeKdQxsiWCf/A==",
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/preact"
+ }
+ },
"node_modules/pvtsutils": {
"version": "1.3.5",
"resolved": "https://registry.npmjs.org/pvtsutils/-/pvtsutils-1.3.5.tgz",
@@ -4083,6 +4108,11 @@
"@types/jasmine": "^3.6.3"
}
},
+ "node_modules/web-vitals": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/web-vitals/-/web-vitals-4.2.1.tgz",
+ "integrity": "sha512-U6bAxeudnhDqcXNl50JC4hLlqox9DZnngxfISZm3DMZnonW35xtJOVUc091L+DOY+6hVZVpKXoiCP0RiT6339Q=="
+ },
"node_modules/webcrypto-core": {
"version": "1.7.9",
"resolved": "https://registry.npmjs.org/webcrypto-core/-/webcrypto-core-1.7.9.tgz",
diff --git a/frontend/package.json b/frontend/package.json
index 224b66d..2b93632 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -41,6 +41,7 @@
"monaco-themes": "^0.4.4",
"next": "14.1.3",
"next-themes": "^0.3.0",
+ "posthog-js": "^1.147.0",
"react": "^18.3.1",
"react-dom": "^18",
"react-hook-form": "^7.51.3",