Getting started

Framework integrations

One package for Nuxt, Astro, Next.js or TanStack Start that sets up WebMCP tracking, Visitors, AI bots and API tracking together.

The browser SDK and the server SDK can each be added by hand (Framework guides, Server SDK). On these frameworks one package does both, and each key you set switches its part on:

KeyWhere it's setWhat it tracks
Public key, al_pub_…config or a public env variableWebMCP tool calls and Visitors, in the browser
Server key, al_srv_…AGENTSTATS_SERVER_KEYAI crawlers and agents, including the ones that never run JavaScript
API key, al_api_…AGENTSTATS_API_KEYcalls AI agents make to your API routes

Without keys, the packages still tell your code who's asking (isBot, isAI, category…) and send nothing.

A Nuxt module, for Nuxt 3, 4 and 5 on every Nitro preset.

npx nuxi module add @agentstats/nuxt
nuxt.config.ts
export default defineNuxtConfig({
  modules: ['@agentstats/nuxt'],
  agentstats: { key: 'al_pub_…' },
})
.env
NUXT_AGENTSTATS_SERVER_KEY=al_srv_…
NUXT_AGENTSTATS_API_KEY=al_api_…

You also get useWebMcpTool() to register a tool while a component is mounted, useAgentStats().track() for conversions, useAgentStatsBot() in pages and event.context.bot in server routes.

Agents that browse in a real browser (ChatGPT agent, Google-Agent, headless browsers) get a short-lived visit cookie from the server half, and the browser half reads it, so their pageviews and WebMCP calls show up as theirs rather than as a person's.
The server half sees requests that reach your server. Pages served from a CDN cache or prerendered at build time don't, so send your host's logs with a log drain to cover them.