|
Netlify
A Netlify Extension that deploys an Edge Function to detect AI bot traffic and report content_retrieved events. Install from the Netlify Extensions directory.
Extensions directory Edge function source_role: edge
How it works
flow
AI Bot ──GET──> Netlify Edge (Deno runtime)
│
├── Edge Function intercepts request
├── Classifies via managed bot detection
├── Passes to origin (no delay)
└── fetch() POST to OA telemetry endpointNetlify Edge Functions run on Deno and support outbound fetch() calls. The extension installs an Edge Function that sits in front of all routes, detects AI bot
traffic, and fires telemetry events without blocking the response.
Built-in precedent
Netlify's own User Agent Blocker extension follows the same pattern - an
Edge Function that detects AI crawlers. The OA extension reports events instead of blocking.
Both use Netlify's managed bot detection rather than hardcoded lists.
Setup
- Find OpenAttribution in the Netlify Extensions directory
- Click Install
- Enter your OA org ID
- The extension deploys an Edge Function automatically
Manual setup
If you prefer to add the Edge Function directly to your project. The extension ships with a managed bot detection module that updates with the extension - no hardcoded list in your code:
netlify/edge-functions/oa-telemetry.ts
import type { Context } from "@netlify/edge-functions";
import { isAiBot } from "@openattribution/netlify-edge";
export default async (request: Request, context: Context) => {
// Pass to origin immediately
const response = await context.next();
const ua = request.headers.get('user-agent') || '';
if (isAiBot(ua)) {
const event = {
type: 'content_retrieved',
timestamp: new Date().toISOString(),
content_url: request.url,
source_role: 'edge',
oa_telemetry_id: request.headers.get('OA-Telemetry-ID') || undefined,
data: { user_agent: ua },
};
// Fire and forget
context.waitUntil(
fetch('https://telemetry.openattribution.dev/v1/events', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
events: [event],
org_id: Netlify.env.get('OA_ORG_ID'),
}),
})
);
}
return response;
};
export const config = { path: "/*" }; Bot detection updates
The
@openattribution/netlify-edge package maintains the AI bot detection list
and updates it independently of your deployment. When new AI agents appear, update the package
to detect them - no code changes needed.Publishing path
Netlify Extensions use a three-stage publishing workflow:
| Stage | Visibility | Review |
|---|---|---|
| Private | Your team only | None |
| Public unlisted | Anyone with the link | None |
| Public listed | In the Extensions directory | Netlify review required |