diff --git a/docs/next.config.mjs b/docs/next.config.mjs index 1958dd19d..040c89bb7 100644 --- a/docs/next.config.mjs +++ b/docs/next.config.mjs @@ -26,6 +26,19 @@ const config = { }, async rewrites() { return [ + // PostHog proxy rewrites to prevent ad blockers + { + source: "/consume/static/:path*", + destination: "https://eu-assets.i.posthog.com/static/:path*", + }, + { + source: "/consume/:path*", + destination: "https://eu.i.posthog.com/:path*", + }, + { + source: "/consume/decide", + destination: "https://eu.i.posthog.com/decide", + }, // Redirect .mdx requests to the llms.mdx route handler { source: '/docs/:path*.mdx', diff --git a/docs/package.json b/docs/package.json index c87f7ee89..2ac6edeb4 100644 --- a/docs/package.json +++ b/docs/package.json @@ -43,6 +43,7 @@ "minimatch": "^10.0.1", "next": "15.3.2", "next-themes": "^0.4.6", + "posthog-js": "^1.235.0", "react": "^18.3.1", "react-dom": "^18.3.1", "react-remove-scroll": "^2.7.0", diff --git a/docs/src/app/layout.tsx b/docs/src/app/layout.tsx index d85cbcae1..f3ed7dd7b 100644 --- a/docs/src/app/layout.tsx +++ b/docs/src/app/layout.tsx @@ -1,6 +1,8 @@ import { StackProvider, StackTheme } from '@stackframe/stack'; import { RootProvider } from 'fumadocs-ui/provider'; import { Inter } from 'next/font/google'; +import PostHogPageView from '../components/pageview'; +import { CSPostHogProvider } from '../components/posthog-provider'; import { stackServerApp } from '../stack'; import './global.css'; @@ -14,17 +16,20 @@ export default function Layout({ children }: { children: React.ReactNode }) {
-