For this guide, we will strictly be referring to Next.js App Router (v13+).
YOUR_TOKEN with your project token.When it comes to Next.js, the recommended way to add scripts to a project is using the root Layout file.
import Script from 'next/script'
export default function RootLayout({
children,
}: {
children: React.ReactNode
}) {
return (
<html lang="en">
<head>
<Script
src="https://cdn.visitors.now/v.js"
data-token="YOUR_TOKEN"
/>
</head>
<body>{children}</body>
</html>
)
}