fix(analytics): add proxy route and correct script URL for OpenPanel

- Add /api/op/[...path] proxy route to forward events to self-hosted OpenPanel
- Add scriptUrl=/api/op/op1.js to OpenPanelComponent
- Proxy prevents ad blockers from blocking tracking requests
This commit is contained in:
Unchained
2026-03-25 19:07:52 +02:00
parent 17367024c2
commit cdd3f9c77e
2 changed files with 12 additions and 5 deletions

View File

@@ -46,11 +46,13 @@ export default async function LocaleLayout({
return (
<>
<OpenPanelComponent
clientId={process.env.NEXT_PUBLIC_OPENPANEL_CLIENT_ID || ""}
trackScreenViews={true}
trackOutgoingLinks={true}
/>
<OpenPanelComponent
clientId={process.env.NEXT_PUBLIC_OPENPANEL_CLIENT_ID || ""}
trackScreenViews={true}
trackOutgoingLinks={true}
apiUrl="/api/op"
scriptUrl="/api/op/op1.js"
/>
<NextIntlClientProvider messages={messages}>
{children}
</NextIntlClientProvider>

View File

@@ -0,0 +1,5 @@
import { createRouteHandler } from "@openpanel/nextjs/server";
export const { GET, POST } = createRouteHandler({
apiUrl: "https://op.nodecrew.me/api",
});