Installation
Install Bantico on Next.js
For this guide, we will strictly be referring to Next.js App Router (v13+).
Replace
YOUR_TOKEN with your Bantico token.Using the root Layout
Add Bantico to your root Layout by setting window.BANTICO_TOKEN before the Bantico script loads.
Layout.tsx
import Script from 'next/script' export default function RootLayout({ children,}: { children: React.ReactNode}) { return ( <html lang="en"> <body>{children}</body> <Script id="bantico-config" strategy="beforeInteractive"> {`window.BANTICO_TOKEN = "YOUR_TOKEN";`} </Script> <Script id="bantico-tracker" src="https://app.bantico.com/bantico.js" strategy="afterInteractive" /> </html> )}