From dabd3c3e682b80500b2e7b5a2151dcc78f94f614 Mon Sep 17 00:00:00 2001 From: Ameya Shenoy Date: Sun, 6 Jul 2025 22:25:37 +0530 Subject: [PATCH] feat: analytics Signed-off-by: Ameya Shenoy --- frontend/Dockerfile | 2 ++ frontend/next.config.ts | 12 ++++++++++++ frontend/src/app/layout.tsx | 6 ++++++ 3 files changed, 20 insertions(+) diff --git a/frontend/Dockerfile b/frontend/Dockerfile index c280794..60de41c 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -10,6 +10,8 @@ RUN npm ci # Copy app source code COPY . . +ENV NEXT_PUBLIC_RYBBIT_HOST=https://app.rybbit.io + # Build the Next.js app RUN npm run build diff --git a/frontend/next.config.ts b/frontend/next.config.ts index e9ffa30..7747cd5 100644 --- a/frontend/next.config.ts +++ b/frontend/next.config.ts @@ -2,6 +2,18 @@ import type { NextConfig } from "next"; const nextConfig: NextConfig = { /* config options here */ + async rewrites() { + return [ + { + source: "/api/script.js", + destination: `${process.env.NEXT_PUBLIC_RYBBIT_HOST}/api/script.js`, + }, + { + source: "/api/track", + destination: `${process.env.NEXT_PUBLIC_RYBBIT_HOST}/api/track`, + }, + ] + }, }; export default nextConfig; diff --git a/frontend/src/app/layout.tsx b/frontend/src/app/layout.tsx index eb31a36..2a8015d 100644 --- a/frontend/src/app/layout.tsx +++ b/frontend/src/app/layout.tsx @@ -1,6 +1,7 @@ import type { Metadata } from "next"; import { ThemeProvider } from "@/components/theme-provider"; import ServiceWorkerManager from "@/components/ServiceWorkerManager"; +import Script from "next/script" import { Geist, @@ -67,6 +68,11 @@ export default function RootLayout({ {children} +