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:
@@ -50,6 +50,8 @@ export default async function LocaleLayout({
|
|||||||
clientId={process.env.NEXT_PUBLIC_OPENPANEL_CLIENT_ID || ""}
|
clientId={process.env.NEXT_PUBLIC_OPENPANEL_CLIENT_ID || ""}
|
||||||
trackScreenViews={true}
|
trackScreenViews={true}
|
||||||
trackOutgoingLinks={true}
|
trackOutgoingLinks={true}
|
||||||
|
apiUrl="/api/op"
|
||||||
|
scriptUrl="/api/op/op1.js"
|
||||||
/>
|
/>
|
||||||
<NextIntlClientProvider messages={messages}>
|
<NextIntlClientProvider messages={messages}>
|
||||||
{children}
|
{children}
|
||||||
|
|||||||
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