AI Bot Monitor - Vercel Integration Documentation

Overview

AI Bot Monitor is a high-performance middleware solution that tracks AI bot visits to your Vercel-deployed website. Discover exactly what prompts led users to your site with non-blocking logging that maintains optimal performance.

Features

  • Real-time tracking of ChatGPT, Perplexity, and other AI bot visits
  • Non-blocking middleware architecture (sub-100ms response times)
  • Flexible storage options: MongoDB Atlas, Vercel KV, or webhook endpoints
  • Intelligent bot detection using advanced user-agent patterns
  • Built-in analytics API endpoints
  • Automatic MongoDB Atlas configuration through Vercel marketplace

Quick Start

1. Install the Integration

Add AI Bot Monitor to your Vercel project through the marketplace integration.

2. Configure Storage

Choose your preferred storage option:

  • MongoDB Atlas: Automatic setup through Vercel marketplace
  • Vercel KV: Redis-based storage for high performance
  • Webhook: Send data to your custom endpoint

3. Deploy

The middleware automatically starts tracking AI bot visits upon deployment.

Configuration

// middleware.ts
import { createAIBotMonitor } from '@getaiso/ai-bot-monitor';

const monitor = createAIBotMonitor({
  storage: {
    type: 'mongodb', // or 'kv', 'webhook', 'console'
    mongodb: {
      database: 'botlogs',
      collections: {
        requests: 'all_requests',
        botVisits: 'visits'
      }
    }
  },
  logging: {
    logAllRequests: true,
    botDetection: true,
    excludePaths: ['/api', '/_next']
  }
});

export default monitor.middleware;

API Endpoints

GET /api/bot-logs

Retrieve AI bot visit analytics

GET /api/all-requests

Get comprehensive request logs

GET /api/analyze-requests

Analyze traffic patterns and trends

Bot Detection Patterns

AI Bot Monitor automatically detects the following AI bots:

  • ChatGPT: OAI-SearchBot, ChatGPT-User, GPTBot
  • Perplexity: PerplexityBot, Perplexity-User
  • Custom Patterns: Add your own detection patterns

Performance

AI Bot Monitor is designed for maximum performance:

  • Non-blocking logging prevents middleware delays
  • Sub-100ms response time overhead
  • Optimized for Vercel Edge Runtime
  • Minimal memory footprint

Support

Need help? Check out our support resources: