Middleware Setup
Install the package:
npm install @crawlready/middleware
# or
pnpm add @crawlready/middleware
Add the crawlready middleware to your Express app before your route handlers:
import express from 'express';
import { crawlready } from '@crawlready/middleware/express';
const app = express();
app.use(crawlready({
siteKey: process.env.CRAWLREADY_SITE_KEY!,
}));
// Your routes follow here
app.get('/', (req, res) => {
res.send('Hello world');
});
app.listen(3000);
Add your site key to your environment:
CRAWLREADY_SITE_KEY=cr_live_xxxxx
The middleware detects AI crawlers from the User-Agent header and fires an analytics beacon in the background. It calls next() immediately and never delays the response.
For all configuration options, see Core Concepts — Middleware Configuration.
Verify Your Integration
After deploying, use the Verify Integration button in your CrawlReady dashboard. It sends a synthetic GPTBot request to your site and confirms that a visit is recorded within 15 seconds.
If the check times out:
- Confirm the middleware is registered before your route handlers.
- Confirm
CRAWLREADY_SITE_KEYis set in the environment where the process runs. - If your app is behind a reverse proxy, ensure the
User-Agentheader is forwarded through.