For this guide, we will strictly be referring to Next.js App Router (v13+).
Replace YOUR_TOKEN with your project token.
YOUR_TOKEN
When it comes to Next.js, the recommended way to add scripts to a project is using the root Layout file.
1import Script from 'next/script' 2 3export default function RootLayout({ 4 children, 5}: { 6 children: React.ReactNode 7}) { 8 return ( 9 <html lang="en"> 10 <head> 11 <Script 12 src="https://cdn.visitors.now/v.js" 13 data-token="YOUR_TOKEN" 14 /> 15 </head> 16 <body>{children}</body> 17 </html> 18 ) 19}