Guides
Install the crawler probe
Server probe, Next proxy or an edge observer — install the lane Studio handoff recommends, and read what each one cannot see.
Pick the lane first
Site settings → Studio handoff tests two homepage responses and names one lane: server probe (origin only), edge observer (before the cache) or page beacon (browser only, never crawlers). Install the lane it recommends; a cached page answers before PHP or Node runs, so an origin probe cannot see those hits. Only one lane per site — the console has no cross-lane dedupe. Pick your collector token under On this page on a wide screen (on a phone, copy it from Site settings → Traffic) and every snippet below is filled in; without it the snippets keep the vdc_your_token placeholder.
A static export has no server to hook: Next.js output: 'export' and a prerendered Astro build never run proxy or middleware after deploy. Their crawler lane is the host edge — a Netlify Edge Function, a Cloudflare zone you control, or Vercel routing middleware for a plain static site. Next.js and Astro projects on Vercel cannot add routing middleware, so a static export there is only observable behind Cloudflare. When the recommendation is the page beacon, that is the honest answer, not a missing step.
WordPress (PHP)
Drop this in wp-content/mu-plugins/visdenda-probe.php. The sidebar token picker fills in the token; otherwise replace it with the collector token from Site settings → Traffic. It fires on front-end requests that reach PHP and skips admin, REST and cron. The CMS connection plugin writes fields; this file only reports hits.
<?php
/* Plugin Name: Visdenda crawler probe */
add_action('muplugins_loaded', function () {
$path = parse_url($_SERVER['REQUEST_URI'] ?? '/', PHP_URL_PATH) ?: '/';
if (preg_match('#^/(wp-admin|wp-json|wp-cron)#', $path)) return;
$ua = $_SERVER['HTTP_USER_AGENT'] ?? '';
if ($ua === '') return; // the probe schema requires a UA
$endpoint = 'https://visdenda.com/v1/probe';
register_shutdown_function(function () use ($path, $endpoint, $ua) {
$payload = [
'v' => 2,
'site' => 'vdc_your_token',
'path' => substr($path, 0, 512),
'ua' => substr($ua, 0, 512),
'ip' => $_SERVER['REMOTE_ADDR'] ?? '',
'status' => http_response_code() ?: 200,
];
if (!empty($_SERVER['HTTP_REFERER'])) {
$payload['ref'] = substr($_SERVER['HTTP_REFERER'], 0, 1024);
}
// Forward Web Bot Auth headers so signed agents are verified, not guessed.
$agent = $_SERVER['HTTP_SIGNATURE_AGENT'] ?? '';
$input = $_SERVER['HTTP_SIGNATURE_INPUT'] ?? '';
$sig = $_SERVER['HTTP_SIGNATURE'] ?? '';
if ($agent !== '' && $input !== '' && $sig !== '') {
$payload['host'] = substr($_SERVER['HTTP_HOST'] ?? '', 0, 253);
$payload['webBotAuth'] = [
'signatureAgent' => substr($agent, 0, 1024),
'signatureInput' => substr($input, 0, 4096),
'signature' => substr($sig, 0, 4096),
];
}
wp_remote_post($endpoint, [
'blocking' => false,
'timeout' => 0.5,
'headers' => ['content-type' => 'application/json'],
'body' => wp_json_encode($payload),
]);
});
}, 1);A full-page cache (WP Rocket, LiteSpeed, Cache Enabler, WP Super Cache) serves HTML before PHP, so this file only sees requests that reach the origin. If Studio handoff reports a page cache, put an edge observer in front. wp_remote_post is non-blocking: the report is best-effort and dropped when the site is unreachable.
Next.js proxy (middleware)
Add proxy.ts at the app root. It runs before the route or the Next cache produces a response, so crawler hits on cached HTML are still seen. Next 15 and earlier name the file middleware.ts and export middleware; the hook body is the same.
import { NextResponse, type NextFetchEvent, type NextRequest } from "next/server";
import { requestMiddleware } from "@visdenda/agent-watch/next";
const probe = requestMiddleware({ token: "vdc_your_token" });
export function proxy(request: NextRequest, event: NextFetchEvent) {
probe(request, (task) => event.waitUntil(task));
return NextResponse.next();
}
export const config = {
matcher: ["/((?!_next/static|_next/image|favicon.ico).*)"],
};Proxy sees the request, not the response, so hits are recorded without a status. A static export (output: 'export') has no proxy or middleware at all: on Vercel that build cannot run a lane of its own, so front it with a Cloudflare zone or deploy it where a host edge function can intercept (see Netlify below).
Cloudflare Worker (edge observer)
A pass-through Worker runs before the zone cache, so it sees requests that never reach the origin — including cached HTML. Only works if you control the zone: a site behind a host's Cloudflare cannot be changed from your account.
import { wrapFetch } from "@visdenda/agent-watch/workers";
export default {
fetch: wrapFetch({ token: "vdc_your_token" }, (request) => fetch(request)),
};Keep one lane per site: do not also run an origin probe. If static assets are served before the Worker, set assets.run_worker_first. Cloudflare WAF and rate-limit rules terminate a request before any Worker runs — those blocks stay invisible unless you enforce them inside the Worker.
Vercel routing middleware
Point vercel.json at a proxy entrypoint. It runs before the filesystem and the cache, including requests for static files. Next.js and Astro build their own routing, so Vercel refuses this for those projects: use the Next proxy above or Astro middleware instead.
// vercel.json
{
"$schema": "https://openapi.vercel.sh/vercel.json",
"proxy": { "entrypoint": "proxy.ts" }
}
// proxy.ts
import { next, waitUntil } from "@vercel/functions";
import { createAgentWatch } from "@visdenda/agent-watch";
const watch = createAgentWatch({ token: "vdc_your_token" });
export default async function proxy(request: Request) {
// next() continues to the origin once; fetching request.url would loop.
const response = await next();
watch.fromRequest(request, { status: response.status, waitUntil });
return response;
}Do not fetch the request URL from inside the proxy: that starts the request chain again and can rewrite into itself. next() continues to the origin exactly once. A Next.js or Astro static export on Vercel has no lane at all: neither project may add Vercel routing middleware, and neither runs server code after export.
Netlify Edge Function
Netlify edge functions run on Deno before redirects, static assets and the cache, so prerendered pages are covered too. Continue the chain with context.next(); fetching the request URL re-enters the same function.
import type { Config, Context } from "@netlify/edge-functions";
import { createAgentWatch } from "npm:@visdenda/agent-watch";
const watch = createAgentWatch({ token: "vdc_your_token" });
export default async (request: Request, context: Context) => {
// Do not fetch the request URL: that re-enters this function.
const response = await context.next();
watch.fromRequest(request, {
status: response.status,
waitUntil: (task) => context.waitUntil(task),
});
return response;
};
export const config: Config = { path: "/*" };Only paths in config.path are covered; a request redirected to a path your function does not declare stays invisible. The function runs before the CDN cache, so cached HTML is counted.
Robots and llms.txt
The probe only observes requests that arrive. If robots.txt blocks AI crawlers, there is nothing to observe: allow GPTBot, ClaudeBot, PerplexityBot and OAI-SearchBot unless you mean to block them, and scope Disallow rules to paths. A missing robots.txt does not block anything. Serve llms.txt so agents get a curated map instead of guessing.
After installing, run Studio handoff again: the lane item turns Done once the probe has reported events in the last 30 days, and crawler hits appear within minutes of the next crawler visit. Check the token before anything else — a wrong token answers 204 to every event, which looks exactly like “installed and quiet”:
curl -X POST https://visdenda.com/v1/probe/check \
-H 'content-type: application/json' \
-d '{"site":"vdc_your_token"}'A 404 means the token is unknown, the site is not verified, or the token was revoked. The check is a POST on purpose: a GET would put the token in access logs and caches.
Was this page helpful?