All docsSearch docs

Start

  1. 01Getting started
  2. 02Install
  3. 03Tracking

Features

  1. 04The dashboard
  2. 05Goals
  3. 06Short links
  4. 07AI sources and agents
  5. 08Email reports
  6. 09Scheduled check
  7. 10Ask your AI

Reference

  1. 11Performance
  2. 12Configuration
  3. 13HTTP API

Platforms

  1. 14Standalone server
  2. 15ClickHouse
  3. 16PHP
  4. 17WordPress
  5. 18Drupal
  6. 19Craft CMS
  7. 20Webflow
  8. 21Python
  9. 22Rails
  10. 23Ruby
  11. 24Go
  12. 25Java
  13. 26.NET
  14. 27Elixir
  15. 28Rust

Trust

  1. 29Privacy

Features

AI sources and agents

Runlight counts the people who arrive from ChatGPT and Claude, and it sees the AI agents that read your pages without running any JavaScript.

AI shows up in your traffic in two ways, and Runlight counts both.

People who came from an AI

When a browser sends a recognized AI referrer after someone clicks a link in an answer from ChatGPT, Claude, Perplexity, Gemini, Copilot, Meta AI, Grok, DeepSeek, Mistral, You.com, or Phind, the visit gets that source and the AI channel. It counts toward visitors and conversions like any other visit, and you can filter by it.

Agents that read your pages

An AI answering a question often fetches your page itself. Most agents do not run JavaScript, so installing the tracking script alone does not make their fetches appear. Runlight needs reporting from the server, a configured CMS plugin, or access logs.

To count them from your server, pass each page request to rl.observe(request).

proxy.ts

import { rl } from "@/lib/runlight";

export async function proxy(request: Request) {
  void rl.observe(request);
  return (await rl.linkDomainResponse(request)) ?? undefined;
}

That file is for Next.js 16 and later. On Next.js 15, name it middleware.ts and rename the function to middleware. From Next.js 15.5, also add export const config = { runtime: "nodejs" }; so your database driver can load. Before Next.js 15.5, middleware runs only on the Edge runtime, so it needs a store that works there, such as Turso over HTTP.

In Express, use app.use(observer(rl)) from @runlight/sdk/node.

In the other languages the middleware or filter that serves Runlight usually records agents too, and each language’s page, from PHP to Rust, shows how. A WordPress, Drupal, or Craft site records them with its plugin, and any other site can report them from its web server’s access log.

observe records GET requests for pages from known agents and ignores everything else, including images, scripts, and styles. It never throws, so it is safe to call on every request. Leave it unawaited and it will not slow the response.

The AI agents box sorts what it sees into two groups and shows which pages each agent read.

The first group fetches a page because a person asked something right now (ChatGPT-User, Claude-User, Perplexity-User, MistralAI-User, and Meta’s fetcher). The second group is crawlers that gather pages ahead of time (GPTBot, ClaudeBot, PerplexityBot, OAI-SearchBot, Amazonbot, CCBot, and others). Runlight keeps these fetches out of visitor and pageview numbers.

Verified and claimed agents

Anyone can send a User-Agent header that says GPTBot, so Runlight also checks where each fetch came from. Several AI companies publish the addresses their agents use, and Runlight compares the request’s IP address with that list. A fetch from a listed address shows under the agent’s name. Any other fetch shows with (claimed) after the name, because only its User-Agent says who sent it.

Company Agents checked
OpenAI ChatGPT-User, OAI-SearchBot, GPTBot
Anthropic Claude-User, Claude-SearchBot, ClaudeBot, Claude-Web, anthropic-ai
Perplexity Perplexity-User, PerplexityBot
Mistral MistralAI-User
DuckDuckGo DuckAssistBot
Common Crawl CCBot

Meta, Amazon, ByteDance, Cohere, You.com, Diffbot, and Timpi publish no list Runlight can read, so their fetches always show as claimed. A fetch also shows as claimed when Runlight never saw its address, such as one reported without an ip or recorded before this check existed.

The address is used for the comparison and then dropped. Runlight keeps only whether the fetch was verified.

Each release of Runlight includes a copy of the lists. The standalone server downloads fresh copies from those companies once a day, and RUNLIGHT_AGENT_RANGES=off turns that off. A library install uses the copy from its release unless you set updateAgentRanges: true, which downloads them during the scheduled check. The download sends nothing about your visitors.

The check needs the agent’s real address. Behind a proxy or CDN, Runlight reads it the same way it reads a visitor’s, as trustProxy describes. The log reader takes it from each line, so behind a CDN make sure your web server logs the client’s address rather than the CDN’s, with nginx’s real_ip module or Caddy’s trusted proxies.

Choose where to report fetches

Site setup Integration
WordPress, Drupal, or Craft Use the Runlight plugin or module. When Runlight is hosted elsewhere, configure its address, site ID, and agents key, or use Connect. Adding only the script tag does not configure agent reporting.
An application with Runlight installed Use its observer middleware or call rl.observe(request) on page requests.
A site whose nginx, Apache, or Caddy logs you can read Run the log reader on that server. It can also see requests served from the web server’s cache.
A static site behind a CDN Use platform request logs or code at the edge where requests arrive. An origin log cannot see requests answered entirely by the CDN.

Choose one reporting path for each request. Running both a plugin and a log reader on the same requests can count a fetch twice.

Report to a Runlight hosted elsewhere

Copy the site’s agents key from Settings, Install. This key can report agent fetches for that site but cannot read its stats. Keep the key on your server and out of browser JavaScript.

Your server can post a known agent’s page request to the observation endpoint. Use the actual request URL and User-Agent header; the following values illustrate the payload.

bash

curl https://stats.example.com/api/observe \
  -H "Authorization: Bearer $RUNLIGHT_AGENTS_KEY" \
  -H "Content-Type: application/json" \
  --data '{"url":"https://example.com/article","userAgent":"ChatGPT-User/1.0","ip":"20.171.206.17"}'

Send the agent’s IP address as ip so Runlight can check it against the company’s list. Without it the fetch is still counted, as claimed. Runlight never checks the address of the server making the report.

A Runlight mounted inside an app usually uses /runlight/api/observe instead. Do not put sample fetches into production just to check the graph. A successful request returns 204; it can still be ignored if it is not a recognized agent or does not belong to the site. The API guide also describes batches and timestamps.

For access logs, use a separate log and agents key for each site.

bash

RUNLIGHT_OBSERVE_KEY="$RUNLIGHT_AGENTS_KEY" npx @runlight/server agents \
  --log /var/log/nginx/example.access.log --to https://stats.example.com \
  --site https://example.com --follow --state /var/lib/runlight/example-agents.json

Run this under a service manager so it restarts after a reboot. The state file preserves progress across restarts, and the reader handles log rotation. On the first run it reads the existing file, so decide whether that history should be imported before starting. Fetches more than a week old are dropped. See AI agents from a log.

Remove personal details from URLs before reporting authenticated pages. Strip sensitive query parameters, tokens, and account-specific paths. An agents key is not a substitute for sanitizing what your integration sends.

Check the result

After a real agent fetch, open AI agents for the matching site and date range. Check both the agent and page tabs. If it stays empty, check the reporting process, its key, the site’s allowed hostnames, and whether the request reached the plugin or origin at all. A CDN cache may have answered it first.

A name without (claimed) came from an address the agent’s company lists as its own. A recorded fetch still does not prove that an AI answer cited your page or that the page was used for training. Human clicks from AI answers still appear under Sources and count as ordinary visits.