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

# How to track website traffic

> How to set up website tracking that tells you where visitors come from and what they do: the tag, events, UTM tags, consent, search data and AI crawlers.

Updated: 2026-11-29

To track website traffic, put an analytics tag on every page, send the actions that matter as events, tag your campaign links, and connect the sources that see what the tag can't, such as Google Search Console. That gives you visits, where they came from and what they led to. With [nextanalytica](/), your agent does most of it: ask "Add nextanalytica to my site", and it adds the tag, shows you the change and asks before committing.

## 1. Add the tag to every page

The tag is one script line in the shared layout of your site. It counts page views, visits, where they came from, clicks, forms, scroll depth, errors and page speed on its own.

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

Copy the line with your project's key from **Site**. Where it goes in Next.js, Nuxt, WordPress, Webflow and others: [Add the tag](/docs/tracking/installation).

## 2. Send what matters as events

Page views don't tell you who signed up or bought. Send those actions yourself:

```js
window.nextanalytica.track("signup_completed", { plan: "team" });
window.nextanalytica.order({ ref: "A-10492", value: 129.9, currency: "EUR" });
```

Mark the ones that count as conversions, and your agent reads conversion rates by channel and page. See [Custom events](/docs/tracking/custom-events) and [Revenue tracking](/docs/learn/revenue-tracking).

## 3. Tag your campaign links

Add `utm_source`, `utm_medium` and `utm_campaign` to every link you share in emails, ads and posts, so each visit is credited to its campaign. See [UTM tags](/docs/learn/utm-tags).

## 4. Decide how consent works

In the EU, analytics that stores something on the device usually needs a yes. nextanalytica's tag counts without cookies until the visitor answers, so you don't lose the visitors who never click your banner. Pass the answer on every page. See [Cookieless counting and consent](/docs/tracking/cookieless-and-consent).

## 5. Connect what the tag can't see

- **Google Search Console:** the searches that showed your site, with clicks and positions. See [Google Search Console](/docs/sources/gsc).
- **AI crawlers:** bots like GPTBot and ChatGPT-User never run the tag; a sender on your server counts them. See [AI crawlers](/docs/tracking/ai-crawlers).
- **Your server's events:** payments and sign-ups your server confirms. See [Revenue tracking](/docs/learn/revenue-tracking).

## 6. Check it works, then ask

Ask your agent "Check my nextanalytica setup": `check_setup` says which hosts are sending and what to do next. Then ask the questions you set it up for:

- "Where did visitors come from this week, and which channel converts best?"
- "Which pages do people land on from Google?"
- "How much traffic came from ChatGPT?"

This command adds nextanalytica to Claude Code:

```bash
claude mcp add --transport http nextanalytica https://mcp.nextanalytica.app/mcp
```

## Next steps

- [How to check your website traffic](/docs/learn/check-website-traffic)
- [Quickstart](/docs/getting-started/quickstart)
- [AI traffic analytics](/docs/tracking/ai-traffic)

Canonical address: https://nextanalytica.app/docs/learn/track-website-traffic
