Set it up
1
Create an API key
On the Vercel integration page, click New API Key, enter a name and click Create API Key. Copy the key from the dialog. Keys start with
aa_. Creating a key needs an Owner or Admin by default.Any Agent Analytics key works for every log source, so you can reuse one from Website > Agent Analytics > Settings. A new key can take up to a minute to start working.2
Add a drain in Vercel
- In the Vercel dashboard, open Team Settings > Drains and click Add Drain.
- Choose Logs as the data type.
- Name the drain (for example “Agent Analytics”) and select the projects to send.
- Under Additional configuration for logs, check the Static Files, Edge Functions and Functions sources and the Production environment. Don’t add sampling rules, so 100% of logs are sent.
3
Point it at ChatFeatured
Select Custom Endpoint and enter:
The format must be NDJSON. With JSON, the drain passes Vercel’s test but nothing is recorded.
4
Test and create
Click Test, confirm it returns a 200 response, then click Create Drain. Test only checks the URL and API key.
Check that it works
A browser visit won’t show anything, because ChatFeatured keeps only requests from recognized bots. Request a page with a crawler user agent instead:What gets recorded
ChatFeatured reads the request log lines from the Static Files, Edge Functions and Functions sources and keeps requests from AI crawlers and search engine bots (see what gets counted). Build logs and console output are skipped. Unlike the Cloudflare Worker, the drain records every path and content type, includingrobots.txt, llms.txt and sitemaps.
Drain Production only. Preview requests aren’t labelled by environment, so they’d mix in with production.
Troubleshooting
Test returns 401
Test returns 401
Missing API key means the header didn’t arrive. Invalid API key means the key is mistyped, deleted, or less than a minute old. Check the header is exactly X-API-Key: aa_....Test passes but no data arrives
Test passes but no data arrives
Check that the drain format is NDJSON, the Static Files, Edge Functions and Functions sources are checked, and the project you tested is selected on the drain.
Related
- Agent Analytics: reading the data
- Vercel’s drain documentation