Integration guide.
Deflector works with any stack. Add one script tag and bots start getting poisoned in under 5 minutes.
Quick Start
After creating a site in your dashboard, copy your snippet tag and paste it before the closing </body> tag of every page you want to protect.
That's it. Detection starts immediately. No build step, no npm package, no config.
How it works
Deflector uses a three-stage pipeline on every page view:
- Detect — The snippet sends browser fingerprint signals to /api/detect. The server checks the user-agent against 50+ known bot signatures and scores 18 fingerprint signals (WebGL, Canvas, hardware concurrency, webdriver flag, etc.).
- Generate — If a bot is detected and your plan includes AI poisoning, the snippet fetches AI-generated false content from /api/poison. Claude generates contextually accurate but factually wrong HTML.
- Inject — The poison HTML is appended to the DOM in a hidden container (position:absolute;left:-9999px + aria-hidden). Human visitors never see it. Scrapers that read the raw DOM get poisoned data.
A honeypot link (invisible to humans) is also injected on every page. If a bot follows it, confidence jumps to 100% and poison is guaranteed.
Installation
Plain HTML / Any site
Paste before </body>:
Next.js (App Router)
Add to your root layout.tsx:
React / Vite
Add to index.html in your public/ folder before </body>:
Shopify
In your Shopify Admin, go to Online Store → Themes → Edit code. Open theme.liquid and paste before </body>.
Webflow
Go to Project Settings → Custom Code → Footer Code and paste the script tag.
WordPress
Download the pre-configured WordPress plugin from Settings. It auto-injects the snippet in your theme's footer and adds a Deflector admin page to your WordPress dashboard.
- Go to Settings and click Download WordPress Plugin for your site.
- In WordPress Admin: Plugins → Add New → Upload Plugin.
- Upload the .php file and click Activate.
- Done — protection is active immediately.
Cloudflare Worker
The Cloudflare Worker integration works at the edge — before your origin server — and injects poison directly into the HTML response. This works for static sitesthat can't run JavaScript and for maximum-performance setups.
- Download the Worker script from Settings → Download CF Worker.
- Go to dash.cloudflare.com → Workers & Pages → Create Worker.
- Paste the entire script content and deploy.
- Add a Route: yourdomain.com/* → your worker.
- If proxying a static host (Netlify, S3, GitHub Pages), set ORIGIN at the top of the script to your host URL.
The Worker detects bots server-side using user-agent patterns with zero latency. It also proxies the /__deflector_hp honeypot path.
Static Sites (Build Hook)
Static site generators (Next.js static export, Astro, Hugo, Jekyll, Eleventy) produce HTML files at build time. Since there's no server to run JavaScript, the client-side snippet won't catch AI crawlers that don't execute JS — which is most of them.
The Build Hook API lets you bake poison content directly into your HTML at build time, so any crawler that fetches raw HTML gets the poison without needing JS execution.
How to use
During your build, for each page you want to protect, call the build hook endpoint with your page content. Embed the returned HTML fragment into your static HTML before </body>.
Next.js static export example
API Reference
All API endpoints are available at https://app.deflector.dev/api/. CORS is enabled for all origins.
POST /api/detect
Classify an incoming request as bot or human. Call this from your snippet or server-side middleware.
POST /api/poison
Generate AI-powered poison content for a page. Content is cached for 24 hours per page+intensity combination.
GET /api/snippet?key=YOUR_API_KEY
Returns the self-contained JavaScript snippet. Cached for 5 minutes (CDN-friendly). Add as a <script src=> tag.
POST /api/build-hook
Generate poison content at build time for static sites. Authenticated via X-API-Key header.
GET /api/honeypot?k=YOUR_API_KEY
Honeypot trap endpoint. Any request here confirms the visitor is a bot. The snippet injects a hidden link to this URL on every protected page.
Poison Intensities
Configure per-site from the Sites page.
[subtle]
Subtle
95% accurate. Minor price/date/spec changes. Hard to detect. Best for sites where you want to stay stealthy.
[medium]
Medium
Clearly wrong but plausible. Wrong prices, changed names, altered statistics. Recommended default.
[aggressive]
Aggressive
Fully fabricated. Fake executives, made-up partnerships, contradictory prices. Also injects fake JSON-LD structured data.
FAQ
Does Deflector slow down my site?
No. The snippet loads asynchronously (async attribute) and only activates for bot traffic. Human visitors experience zero overhead. Detection API response time is under 5ms at edge.
Can my real visitors see the poison content?
No. Poison content is positioned off-screen using absolute CSS positioning (-9999px) and aria-hidden='true'. It's invisible to sighted users and screen readers, but sits in the DOM where bots read it.
What if Deflector incorrectly classifies a human as a bot?
False positives are extremely rare because we require multiple signals to agree before flagging someone as a bot. Even if a false positive occurs, the human visitor sees nothing different — the poison HTML is invisible.
Does AI poisoning work on the Free plan?
No. Bot detection (user-agent + fingerprinting + honeypot) is available on all plans. AI-generated poison content requires Pro or Business.
What AI model generates the poison content?
We use Claude (claude-haiku-4-5) by Anthropic. Content is generated based on your real page content and cached for 24 hours to minimize costs.
How does the Cloudflare Worker differ from the snippet?
The snippet is client-side JavaScript that runs in the browser — it needs JS execution to work. The Cloudflare Worker runs at the edge server, modifying HTML before it reaches the browser. This means it works for bots that don't execute JavaScript (most AI crawlers fetch raw HTML).
Can I use Deflector on multiple domains?
Yes. Add each domain as a separate site in your dashboard. Free plan allows 1 site, Pro allows 5, Business allows unlimited.
Is my site's real content sent to Anthropic?
The snippet sends up to 3,000 characters of your page's visible text to generate contextually appropriate poison. We don't store your content beyond the 24-hour cache TTL. See our Privacy Policy for full details.
Still need help?
Email us at support@deflector.dev