diff --git a/apps/app/app/layout.tsx b/apps/app/app/layout.tsx
index 3bbcb42..c1d8ddb 100644
--- a/apps/app/app/layout.tsx
+++ b/apps/app/app/layout.tsx
@@ -7,6 +7,7 @@ import { AppSidebar } from "@/components/custom/sidebar/sidebar";
import { cookies } from "next/headers";
import Infobar from "@/components/custom/infobar/infobar";
import ProgressBar from "@/components/custom/progress.bar";
+import { PosthogProvider } from "@/hooks/posthog";
export const metadata: Metadata = {
title: "Plura",
@@ -23,25 +24,27 @@ async function RootLayout({
return (
-
-
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
);
}
diff --git a/apps/app/hooks/posthog.tsx b/apps/app/hooks/posthog.tsx
new file mode 100644
index 0000000..e4ce0e7
--- /dev/null
+++ b/apps/app/hooks/posthog.tsx
@@ -0,0 +1,17 @@
+"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 PosthogProvider({
+ children,
+}: Readonly<{
+ children: React.ReactNode;
+}>) {
+ return {children};
+}
diff --git a/apps/www/app/layout.tsx b/apps/www/app/layout.tsx
index c72ae79..b75e5d9 100644
--- a/apps/www/app/layout.tsx
+++ b/apps/www/app/layout.tsx
@@ -2,6 +2,7 @@ import type { Metadata } from "next";
import { GeistSans } from "geist/font/sans";
import "./globals.css";
import { ThemeProvider } from "@/hooks/theme-provider";
+import { PosthogProvider } from "@/hooks/posthog";
export const metadata: Metadata = {
title: "Plura",
@@ -15,20 +16,22 @@ export default function RootLayout({
}>) {
return (
-
-
+
-
- {children}
-
-
-
+
+
+ {children}
+
+
+
+
);
}
diff --git a/apps/www/hooks/posthog.tsx b/apps/www/hooks/posthog.tsx
new file mode 100644
index 0000000..e4ce0e7
--- /dev/null
+++ b/apps/www/hooks/posthog.tsx
@@ -0,0 +1,17 @@
+"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 PosthogProvider({
+ children,
+}: Readonly<{
+ children: React.ReactNode;
+}>) {
+ return {children};
+}
diff --git a/package.json b/package.json
index 4d250af..0dcef2b 100644
--- a/package.json
+++ b/package.json
@@ -47,6 +47,7 @@
"next": "15.0.2",
"next-auth": "5.0.0-beta.25",
"postcss": "^8",
+ "posthog-js": "^1.184.1",
"supertest": "^7.0.0",
"tailwindcss": "^3.4.1",
"typescript": "^5",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 511d750..5034855 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -38,6 +38,9 @@ importers:
postcss:
specifier: ^8
version: 8.4.47
+ posthog-js:
+ specifier: ^1.184.1
+ version: 1.184.1
supertest:
specifier: ^7.0.0
version: 7.0.0
@@ -3595,6 +3598,9 @@ packages:
core-js-pure@3.39.0:
resolution: {integrity: sha512-7fEcWwKI4rJinnK+wLTezeg2smbFFdSBP6E2kQZNbnzM2s1rpKQ6aaRteZSSg7FLU3P0HGGVo/gbpfanU36urg==}
+ core-js@3.39.0:
+ resolution: {integrity: sha512-raM0ew0/jJUqkJ0E6e8UDtl+y/7ktFivgWvqw8dNSQeNWoSDLvQ1H/RN3aPXB9tBd4/FhyR4RDPGhsNIMsAn7g==}
+
core-util-is@1.0.3:
resolution: {integrity: sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==}
@@ -4240,6 +4246,9 @@ packages:
picomatch:
optional: true
+ fflate@0.4.8:
+ resolution: {integrity: sha512-FJqqoDBR00Mdj9ppamLa/Y7vxm+PRmNWA67N846RvsoYVMKB4q3y/de5PA7gUmRMYK/8CMz2GDZQmCRN1wBcWA==}
+
figures@3.2.0:
resolution: {integrity: sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==}
engines: {node: '>=8'}
@@ -5622,6 +5631,9 @@ packages:
resolution: {integrity: sha512-56rxCq7G/XfB4EkXq9Egn5GCqugWvDFjafDOThIdMBsI15iqPqR5r15TfSr1YPYeEI19YeaXMCbY6u88Y76GLQ==}
engines: {node: ^10 || ^12 || >=14}
+ posthog-js@1.184.1:
+ resolution: {integrity: sha512-q/1Kdard5SZnL2smrzeKcD+RuUi2PnbidiN4D3ThK20bNrhy5Z2heIy9SnRMvEiARY5lcQ7zxmDCAKPBKGSOtQ==}
+
preact-render-to-string@5.2.3:
resolution: {integrity: sha512-aPDxUn5o3GhWdtJtW0svRC2SS/l8D9MAgo2+AWml+BhDImb27ALf04Q2d+AHqUUOc6RdSXFIBVa2gxzgMKgtZA==}
peerDependencies:
@@ -5630,6 +5642,9 @@ packages:
preact@10.11.3:
resolution: {integrity: sha512-eY93IVpod/zG3uMF22Unl8h9KkrcKIRs2EGar8hwLZZDU1lkjph303V9HZBwufh2s736U6VXuhD109LYqPoffg==}
+ preact@10.24.3:
+ resolution: {integrity: sha512-Z2dPnBnMUfyQfSQ+GBdsGa16hz35YmLmtTLhM169uW944hYL6xzTYkJjC07j+Wosz733pMWx0fgON3JNw1jJQA==}
+
prelude-ls@1.2.1:
resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==}
engines: {node: '>= 0.8.0'}
@@ -6762,6 +6777,9 @@ packages:
wcwidth@1.0.1:
resolution: {integrity: sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==}
+ web-vitals@4.2.4:
+ resolution: {integrity: sha512-r4DIlprAGwJ7YM11VZp4R884m0Vmgr6EAKe3P+kO0PPj3Unqyvv59rczf6UiGcb9Z8QxZVcqKNwv/g0WNdWwsw==}
+
webidl-conversions@3.0.1:
resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==}
@@ -10073,6 +10091,8 @@ snapshots:
core-js-pure@3.39.0: {}
+ core-js@3.39.0: {}
+
core-util-is@1.0.3: {}
cors@2.8.5:
@@ -10972,6 +10992,8 @@ snapshots:
optionalDependencies:
picomatch: 4.0.2
+ fflate@0.4.8: {}
+
figures@3.2.0:
dependencies:
escape-string-regexp: 1.0.5
@@ -12627,6 +12649,13 @@ snapshots:
picocolors: 1.1.1
source-map-js: 1.2.1
+ posthog-js@1.184.1:
+ dependencies:
+ core-js: 3.39.0
+ fflate: 0.4.8
+ preact: 10.24.3
+ web-vitals: 4.2.4
+
preact-render-to-string@5.2.3(preact@10.11.3):
dependencies:
preact: 10.11.3
@@ -12634,6 +12663,8 @@ snapshots:
preact@10.11.3: {}
+ preact@10.24.3: {}
+
prelude-ls@1.2.1: {}
prettier-plugin-packagejson@2.5.3(prettier@3.3.3):
@@ -13986,6 +14017,8 @@ snapshots:
dependencies:
defaults: 1.0.4
+ web-vitals@4.2.4: {}
+
webidl-conversions@3.0.1: {}
whatwg-url@5.0.0: