New: Free plan is live 7 August 2026 · View changelog →
Antlytics logoAntlytics

Next.js App Router

Add analytics once in your root layout so it runs on every route.

npm install @antlytics/analytics
// app/layout.tsx
import { Analytics } from "@antlytics/analytics/next"

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html lang="en">
      <body>
        {children}
        <Analytics trackingId="YOUR_TRACKING_ID" />
      </body>
    </html>
  )
}

Prefer the exact tracking ID from Settings → Tracking Snippet. The component loads the hosted tracker.js (SPA navigations, 30-minute idle visits, sticky UTMs, engagement).

For a first-party proxy, see First-party proxy.

Something missing? Get in touch and we will update these docs.