Tracker
Next.js tracker
Script in the root layout, middleware for crawlers, and optional hash tracking for docs.
Root layout
app/layout.tsx
import Script from 'next/script'
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="en">
<body>
{children}
<Script
src={process.env.NEXT_PUBLIC_V5_SCRIPT!}
data-domain={process.env.NEXT_PUBLIC_V5_DOMAIN}
strategy="afterInteractive"
/>
</body>
</html>
)
}Pair with middleware
App Router middleware runs on the edge before the document is sent. That is where GPTBot is visible. Follow Next.js middleware.
Something off? Open an issue · Edit on GitHub

