How do I install a visitor ID tag on Next.js App Router?

On Next.js App Router, your visitor identification tag goes in: Import Script from 'next/script' in app/layout.tsx or app/[route]/layout.tsx. The install itself takes minutes; the part that goes wrong on Next.js App Router is below.

Where the tag goes

  1. Import Script from 'next/script' in app/layout.tsx or app/[route]/layout.tsx.
  2. Paste your vendor’s tag snippet exactly as issued. Do not wrap it in extra script tags or reformat it.
  3. Publish or deploy, then verify (below) before trusting data.

What breaks visitor tracking on Next.js App Router?

Script component strategy prop defaults to 'afterInteractive'; 'worker' strategy (Partytown) is experimental and does not work with App Router.

How do you verify the tag fires?

Build and run dev server (npm run dev), inspect page source for <script> tag in HTML.

Then run through the labeled QA checklist before you rely on the numbers, and set expectations with the match-rate calculator — no vendor identifies every visitor.

All platform install guides