Install on Next.js
Use next/script in your root layout.
Add the tag to your root layout with next/script:
// app/layout.tsx
import Script from "next/script";
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="en">
<body>
{children}
<Script src="https://cdn.wholayer.com/t.js" data-site="YOUR_SITE_KEY" strategy="afterInteractive" />
</body>
</html>
);
}Client-side navigation is tracked automatically: the tag listens for history changes, so you don't need to call anything on route change.
Was this helpful?