Skip to main content
DocsInstallation
Quickstart · 2 minutes

Install CiteRoute Telemetry

Choose the integration method that matches your architecture. Server / Edge Middleware (`@citeroute/edge`) runs at the HTTP request layer to capture headless AI crawlers, suspected agent requests, and AI referrals, while the Browser `<script>` Snippet runs in client browsers to capture human AI referrals and JS-executing headless browsers.

Coverage Comparison: Browser Snippet vs. Server / Edge Middleware

Stage 5 Observed-Event Model (v2.0)
Observed Traffic CategoryBrowser <script> TagServer / Edge Middleware (@citeroute/edge)
AI Referrals (AI_REFERRAL)Human visits clicking links in ChatGPT, Perplexity, Claude, Gemini, Google AI ModeFull coverage (via document.referrer)Full coverage (via HTTP Referer)
Crawler Requests (CRAWLER_REQUEST)GPTBot, OAI-SearchBot, PerplexityBot, ClaudeBot, Google-Extended, CCBotNot captured (headless HTTP crawlers do not execute <script> tags)Full coverage (intercepted at HTTP layer)
Suspected Agent Requests (SUSPECTED_AGENT_REQUEST)Playwright, Puppeteer, HeadlessChrome, OpenAI-Operator, LangChain, python-requestsPartial (JS-executing headless browsers only; misses python-requests / axios)Full coverage (all HTTP & browser agents)
Confirmed Conversions (AGENT_TX)Orders with verified checkout evidence (settlementValue > 0)Never inferred from pageviewsRecorded via authenticated POST /api/v1/analytics with settlementValue > 0
middleware.ts (or src/middleware.ts) · Project Root
// 1. Install official SDK:
// pnpm add @citeroute/edge

import { createNextMiddleware } from '@citeroute/edge/next';

export const middleware = createNextMiddleware({
  domain: 'yourdomain.com', // Replace with your domain
  apiKey: process.env.CITEROUTE_API_KEY, // Optional cr-live_ key
  optimizeForBots: true, // Rewrites bot responses to clean Markdown
  manifestPath: '/.well-known/agent.json',
  llmsTxtPath: '/llms.txt',
});

export const config = {
  matcher: ['/((?!api/|_next/static|_next/image|favicon.ico|robots.txt).*)'],
};

Install via `pnpm add @citeroute/edge`. Intercepts headless AI crawlers (GPTBot, ClaudeBot, etc.) before page render. Automatically serves /.well-known/agent.json and /llms.txt with zero added latency.

No cookies or PII
Zero added page latency
Serverless & Edge ready

Verify your installation

Enter your domain and we'll probe whether Edge Middleware or the Tracking Tag is active.

Verify the installation

1

Open your site + DevTools

Network tab → filter "track". You should see a POST to citeroute.com/api/v1/track fire on page load.

2

Check the response

You will see:

{ "success": true, "recorded": false, "classification": "HUMAN" }
3

Verify ownership in My Sites

Add your domain under My Sites. We give you a meta tag or DNS TXT record unique to your account. Publish either one so only you can view the site's analytics. An installed tag alone does not prove ownership.

4

All good

Human visits are not stored by design. AI crawlers appear in your analytics within 24-48 h. Run a GEO Audit to kick-start crawling.

FAQ

What is the difference in coverage between the Browser <script> tag and Server/Edge Middleware?

The Browser <script> tag runs inside JavaScript-capable browsers: it accurately captures AI Referrals (human visitors clicking links from ChatGPT, Perplexity, Claude, Gemini, Copilot, and Google AI Mode) and JS-executing headless browsers (Playwright/Puppeteer), but it CANNOT observe non-JS HTTP crawlers (GPTBot, ClaudeBot, PerplexityBot, OAI-SearchBot, python-requests) because those bots fetch raw HTML without executing <script> tags. Server/Edge Middleware (@citeroute/edge) runs at the HTTP request layer before page render and captures 100% of Crawler Requests, Suspected Agent Requests, and AI Referrals.

What is yourdomain.com?

Replace it with your actual domain - e.g. stripe.com or myblog.io. Do not include https:// or a trailing slash. This is how CiteRoute attributes AI traffic to your site.

Does a User-Agent match prove verified bot identity or a purchase?

No. CiteRoute records classificationMethod and heuristic confidence separately from identityVerified. Standard User-Agent and Referer header matches are recorded with identityVerified: false. Furthermore, automated agent-pattern requests are classified as SUSPECTED_AGENT_REQUEST and are never presented as a purchase (AGENT_TX) unless explicit conversion evidence (settlementValue > 0) is provided.

Does it slow down my site?

No. The async attribute means it never blocks rendering. The beacon fires via navigator.sendBeacon on the load event - fire-and-forget, no response wait.

Is it GDPR / CCPA compliant?

Yes. No cookies. No IP addresses stored. No personal data collected. The only data sent is the URL path and an anonymous sessionStorage ID. Standard non-AI human visits are never written to the database.

I see recorded: false - is that normal?

Yes. Standard human visits without an AI service referrer are intentionally not stored. CiteRoute only persists AI referrals, crawler requests, and suspected agent traffic. recorded: false means the script is working correctly.

Do I need an API key?

The browser tag works without an API key (rate-limited per visitor IP). Server/Edge Middleware should pass an API key owned by the account that verified the domain to unlock the higher server-side ingestion quota (1,200 events/min).

What to do next