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:
@@ -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>
|
||||
|
||||
5
src/app/api/op/[...path]/route.ts
Normal file
5
src/app/api/op/[...path]/route.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import { createRouteHandler } from "@openpanel/nextjs/server";
|
||||
|
||||
export const { GET, POST } = createRouteHandler({
|
||||
apiUrl: "https://op.nodecrew.me/api",
|
||||
});
|
||||
Reference in New Issue
Block a user