> AI agents: this is one page of nextanalytica's docs. The full index for agents: https://nextanalytica.app/llms.txt

# Add the tag

> Put one script line in the head of every page. Where it goes in plain HTML, site builders and each framework.

Updated: 2026-11-17

The tag is one script line that counts your site's visits. Get it right once, in the shared layout, and every page is counted. Every project has its own line; copy it from **Tracking**, or let your agent take it from `get_tag`.

```html title="index.html"
<script async src="https://t.nextanalytica.app/t.js" data-project="na_…"></script>
```

`na_…` is your project's key. Never make one up: a line written from memory counts nothing.

> **Tip:** Connected agents add the tag for you: ask "Add nextanalytica to my site". It calls `get_tag`, shows you the change and asks before committing.

## Where does the tag go?

Put the line in the `<head>` of every page, once, in the layout every page shares.

| Your site | Where |
| --- | --- |
| Plain HTML | The `<head>` of every page, or of the shared template. |
| WordPress, Webflow, Framer, Shopify, Wix, Squarespace | The site's custom code for the head of every page. |
| Google Tag Manager | A Custom HTML tag with the line, triggered on All Pages. |
| Next.js (App Router) | `app/layout.tsx`, with `next/script`, inside `<body>`. |
| Next.js (Pages Router) | `pages/_app.tsx`, with `next/script`. |
| React, Vue or Svelte with Vite | `index.html`, inside `<head>`. |
| Nuxt | `nuxt.config.ts`, in `app.head.script`. |
| SvelteKit | `src/app.html`, inside `<head>`. |
| Astro | The shared layout's `<head>`, with `is:inline`. |
| Remix and React Router | `app/root.tsx`, inside `<head>`. |

For Next.js:

```tsx title="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://t.nextanalytica.app/t.js" data-project="na_…" strategy="afterInteractive" />
      </body>
    </html>
  );
}
```

For Nuxt:

```ts title="nuxt.config.ts"
export default defineNuxtConfig({
  app: { head: { script: [{ src: "https://t.nextanalytica.app/t.js", async: true, "data-project": "na_…" }] } },
});
```

Single-page navigation is counted on its own, and the same line works on your subdomains.

## How do you check it works?

Click **Verify** in **Tracking**. It opens your site; one visit with the tag proves the site is yours, and the domain turns live within about a minute. Visits are kept from then on, not before.

## Next steps

- [What the tag collects](/docs/tracking)
- [Cookieless counting and consent](/docs/tracking/cookieless-and-consent)
- [Custom events](/docs/tracking/custom-events)

Canonical address: https://nextanalytica.app/docs/tracking/installation
