Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,20 @@ const config = {
},
async rewrites() {
return [
// First-party Rybbit proxy, restricted to tracking endpoints.
...[
"script.js",
"replay.js",
"metrics.js",
"track",
"identify",
"session-replay/record/:siteId",
"site/tracking-config/:siteId",
"site/:siteId/feature-flags/evaluate",
].map((path) => ({
source: `/collect/${path}`,
destination: `https://insights.kopexa.com/api/${path}`,
})),
{
source: "/:lang/:path*.mdx",
destination: "/:lang/llms.mdx/:path*",
Expand Down
7 changes: 7 additions & 0 deletions src/app/[lang]/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import "@/app/global.css";
import { NextProvider } from "fumadocs-core/framework/next";
import { TreeContextProvider } from "fumadocs-ui/contexts/tree";
import Script from "next/script";
import { source } from "@/lib/source";
import { Provider } from "./provider";

Expand All @@ -24,6 +25,12 @@ export default async function Layout({
<Provider lang={lang}>{children}</Provider>
</TreeContextProvider>
</NextProvider>
<Script
id="kopexa-rybbit"
src="/collect/script.js?siteId=a087211a63fa"
strategy="afterInteractive"
data-replay-mask-all-inputs="true"
/>
</body>
</html>
);
Expand Down
4 changes: 2 additions & 2 deletions src/proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ export default async function proxy(
}

export const config = {
// Matcher ignoring `/_next/` and `/api/`
// Keep tracking requests out of locale redirects.
// You may need to adjust it to ignore static assets in `/public` folder
matcher: [
"/((?!api|_next/static|_next/image|favicon.ico|icon|sitemap.xml).*)",
"/((?!collect(?:/|$)|api|_next/static|_next/image|favicon.ico|icon|sitemap.xml).*)",
],
};
Loading