N
SPA
Next.js / React
Script in _document.tsx (Pages Router) or layout.tsx (App Router) with strategy=beforeInteractive.
01
Next.js App Router (Next 13+)
In app/layout.tsx add a Script from next/script:
import Script from 'next/script'
export default function RootLayout({ children }) {
return (
<html lang="en">
<head>
<Script
src="https://consentlane.com/v1/cl.js?s=YOUR_KEY"
strategy="beforeInteractive"
/>
</head>
<body>{children}</body>
</html>
)
}
02
Next.js Pages Router
In pages/_document.tsx:
import { Html, Head, Main, NextScript } from 'next/document'
export default function Document() {
return (
<Html lang="en">
<Head>
<script async src="https://consentlane.com/v1/cl.js?s=YOUR_KEY" />
</Head>
<body>
<Main />
<NextScript />
</body>
</Html>
)
}
03
Re-open cookie settings
cl.js exposes a global window.cmpReopen() - you can call it from a footer link („Cookie settings"):
<a onClick={() => window.cmpReopen?.()}>Cookie settings</a>
Ready to try? The Free plan is enough to start.
Sign up