# AI Search, Crawler, Bot Analytics

Track AI search engines, crawlers, and bots visiting your website. Get insights into traffic from AI platforms like ChatGPT, Claude, and Perplexity.

## AI Analytics Setup Guide

Server side analytics tracks AI agents, crawlers, and all other bots that don't run JavaScript. You need to add this to your server's middleware.

You can use our REST API. We also provide a Next.js middleware for you to use.

**Endpoint**

```javascript
POST https://analytics.promptmonitor.io/v1/visits/track
```

**Headers**

```javascript
Content-Type: application/json
```

**Body**

```json
{
  "website_id": "your-website-id",
  "request_path": "/current/path",
  "request_method": "GET",
  "request_headers": {
    "user-agent": "User-Agent header from request",
    "referer": "Referer header from request",
    "host": "Host header from request"
  }
}
```

**Implementation Tips**

- Add this call in your server middleware to cover all pages
- Make the call non-blocking to avoid adding latency
- Handle errors silently so they don't break your pages

**Example with cURL**

```bash
curl -X POST https://analytics.promptmonitor.io/v1/visits/track \
  -H "Content-Type: application/json" \
  -d '{
    "website_id": "your-website-id",
    "request_path": "/",
    "request_method": "GET",
    "request_headers": {
      "user-agent": "GPTBot/1.0",
      "referer": "",
      "host": "example.com"
    }
  }'
```

## AI Crawlers, Bots that we track

- **ChatGPT** - OpenAI's conversational AI and search
- **Claude** - Anthropic's AI assistant
- **Perplexity** - AI-powered search engine
- **Gemini** - Google's AI platform
- **DeepSeek** - Advanced AI search
- **Others** - Various AI crawlers and bots

## Debugging

**Not seeing AI traffic?**

- Verify your website_id from the Web Analytics page
- Add a console.log to confirm middleware is running
- Check that the API endpoint is accessible from your server

**Need help?** Contact support or check the [Web Analytics](/content/docs/analytics/web-analytics/index.html) overview.
