Coding agents
Production sites
Staging is best: bot protection is usually off and analytics are separate. On production, set three things up first, or virtual users may be blocked as an attack or counted as real traffic.
How virtual users identify themselves
| What | Value | Use it to |
|---|---|---|
Header X-Usercase-Agent | the kind of visitor, e.g. qa-explore | separate them in logs and server-side analytics |
Header X-Usercase-Key | your own secret, sent only to your site | let them through your firewall or CDN |
| User-Agent suffix | UsercaseQA/1.0 (<kind>) | exclude them in browser analytics and in logs that drop headers |
Let them through your firewall
Make a random secret of 16 characters or more, pass it as USERCASE_AGENT_KEY, and allow requests whose X-Usercase-Key header matches it. Don’t allow on X-Usercase-Agent alone; anyone can send that.
node -e "console.log(require('crypto').randomBytes(24).toString('base64url'))"
claude mcp add usercase -e USERCASE_AGENT_KEY=<your secret> -- npx -y @usercase/mcp@latest
Keep them out of analytics and logs
- In analytics, filter out sessions whose user agent contains
UsercaseQA. - In logs, separate them by the
X-Usercase-Agentheader or the user-agent suffix.