Sign inGet started
Tracking

Add the tag

View as MarkdownOpen in ChatGPTOpen in Claude
Connect your agent
Add to CursorAdd to VS Code

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

Updated

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.

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.

Where does the tag go?

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

Your siteWhere
Plain HTMLThe <head> of every page, or of the shared template.
WordPress, Webflow, Framer, Shopify, Wix, SquarespaceThe site's custom code for the head of every page.
Google Tag ManagerA 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 Viteindex.html, inside <head>.
Nuxtnuxt.config.ts, in app.head.script.
SvelteKitsrc/app.html, inside <head>.
AstroThe shared layout's <head>, with is:inline.
Remix and React Routerapp/root.tsx, inside <head>.

For Next.js:

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:

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

Related
  • What the tag collects: Page views, clicks, forms, scroll, errors and page speed, counted without code. What never leaves the page.
  • Cookieless counting and consent: The tag counts without cookies until a visitor agrees. How consent works, from your banner or your code.
  • Custom events: Send your own events and orders, such as sign-ups, demo requests and purchases, with one line of JavaScript each, so revenue ties to the visit.
  • Identify people: Name signed-in people with identify, so their visits on every device make one profile your agent can read. It works only after the visitor's consent.
  • Subdomains, domains and Safari: Keep one visitor across your subdomains and your other domains, and stop Safari from forgetting returning visitors after 7 days.
  • Events from Google's dataLayer: The tag reads the events your site already pushes for Google Tag Manager, such as purchases and sign-ups.
Still have questions?
Was this page useful?