📈 Posthog package (#1431)

This commit is contained in:
Luke Vella 2024-11-09 11:30:14 +00:00 committed by GitHub
parent 0fc7d0a0c8
commit a5da319d82
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
43 changed files with 189 additions and 133 deletions

View file

@ -1,4 +1,5 @@
import languages from "@rallly/languages";
import { withPostHog } from "@rallly/posthog/next/middleware";
import { NextResponse } from "next/server";
import withAuth from "next-auth/middleware";
@ -34,7 +35,11 @@ export const middleware = withAuth(
const res = NextResponse.rewrite(newUrl);
await initGuest(req, res);
const jwt = await initGuest(req, res);
if (jwt?.sub) {
await withPostHog(res, { distinctID: jwt.sub });
}
return res;
},