> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chatfeatured.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Vercel

Track AI bot activity on your website using Vercel Log Drains

**Status:** Available | **Complexity:** Intermediate | **Setup time:** 10-15 minutes | **Plan requirement:** Pro or Enterprise

The Vercel integration enables server-side tracking of AI crawler activity on your website using Vercel Log Drains. This allows you to monitor when AI bots like GPTBot, ClaudeBot, and PerplexityBot access your content.

## Why Use Vercel Log Drains?

Traditional analytics tools rely on JavaScript that runs in the browser. AI crawlers don't execute JavaScript, so they're invisible to tools like Google Analytics.

Vercel Log Drains capture server-side logs from your Edge Functions, Serverless Functions, and static files, giving you complete visibility into how AI platforms discover and index your content.

### Benefits

* Capture AI crawler traffic that JavaScript-based analytics miss
* Zero code changes - Configure entirely through the Vercel dashboard
* Real-time logging - Logs are streamed as requests happen
* Works with any Vercel project - Next.js, static sites, or any other framework

***

## Prerequisites

Before you begin, you'll need:

* A Vercel account on the Pro or Enterprise plan
* A deployed project on Vercel
* A ChatFeatured account with Agent Analytics enabled

<Warning>
  Vercel Log Drains are **only available on Pro and Enterprise plans**. If you're on the Hobby plan, consider using our [Cloudflare integration](/integrations/cloudflare) instead.
</Warning>

***

## Setup Instructions

### Step 1: Get Your API Key

1. Log in to ChatFeatured and navigate to your brand
2. Go to **Agent Analytics** > **Settings**
3. Click **Create API Key** and give it a name (e.g., "Vercel Log Drain")
4. Copy the generated API key - you'll need it in Step 9

<Tip>
  Create a dedicated API key for Vercel so you can revoke it independently if needed.
</Tip>

### Step 2: Go to Vercel Dashboard

Navigate to [https://vercel.com/dashboard](https://vercel.com/dashboard)

### Step 3: Open Team Settings

Click on your team name in the top-left corner → Select **Settings**

### Step 4: Navigate to Drains

In the left sidebar, click **Drains**

### Step 5: Add a New Drain

Click the **Add Drain** button

### Step 6: Select Data Type

Choose **Logs** from the available options

### Step 7: Configure Basic Settings

* **Name:** `Agent Analytics`
* **Projects:** Select the projects you want to monitor

<Info>
  You can configure the drain for all projects or select specific ones. Start with your production projects.
</Info>

### Step 8: Configure Log Sources

Expand "Additional configuration for logs":

* **Sources:** Check the following options:
  * Static Files
  * Edge Functions
  * Functions
* **Environments:** Check `Production`
* **Sampling:** Leave at `100%`

<Info>
  These sources include HTTP request data with user agents, which is required for AI bot identification. Don't modify sampling unless you have very high traffic.
</Info>

### Step 9: Configure Destination

Select the **Custom Endpoint** tab and configure:

| Field          | Value                                            |
| -------------- | ------------------------------------------------ |
| Endpoint URL   | `https://ingest.chatfeatured.com/v1/logs/vercel` |
| Format         | NDJSON                                           |
| Custom Headers | `X-API-Key: YOUR_API_KEY`                        |

Replace `YOUR_API_KEY` with the API key from Step 1.

**Format Explanation:** NDJSON (newline-delimited JSON) is a streaming format that sends one JSON object per line. This is optimal for log streaming.

### Step 10: Test and Create

1. Click **Test** to verify the connection returns a 200 response
2. Click **Create Drain**

<Tip>
  The test connection validates that your endpoint URL and API key are correct before creating the drain.
</Tip>

### Step 11: Verify Setup

Once configured, AI crawler traffic will appear in your Agent Analytics dashboard within a few minutes. Visit your site to generate some traffic, then check your dashboard for incoming data.

***

## How It Works

Vercel Log Drains stream logs from your deployment:

1. **Request arrives** at Vercel's edge
2. **Vercel processes** the request through your application
3. **Logs are generated** containing request metadata (URL, user agent, IP, etc.)
4. **Logs are streamed** to ChatFeatured's ingestion endpoint in real-time (NDJSON format)
5. **AI crawlers identified** and displayed in your analytics dashboard

## What Gets Tracked

The Log Drain captures the following data for each request:

* **Host** - The domain being accessed
* **Path** - The URL path being requested
* **User Agent** - Used to identify AI crawlers
* **IP Address** - For geographic insights
* **Status Code** - The HTTP response status
* **Timestamp** - When the request occurred
* **Request Method** - GET, POST, etc.

ChatFeatured's backend automatically identifies AI crawlers (GPTBot, ClaudeBot, PerplexityBot, Bingbot, etc.) and filters out regular user traffic.

***

## Advanced Configuration

### Filtering Projects

You can configure the Log Drain to only track specific projects:

1. When creating or editing the drain, select specific projects instead of "All Projects"
2. This is useful if you only want to track production marketing sites, not development projects
3. You can create multiple drains with different project filters

### Multi-Environment Tracking

To track multiple environments:

1. Create separate drains for each environment (Production, Preview, Development)
2. Use different drain names to distinguish them (e.g., "Agent Analytics - Production")
3. Filter by environment in each drain configuration

### Custom Endpoint Headers

If you need to pass additional headers:

1. In the Custom Headers field, you can add multiple headers separated by newlines
2. Format: `Header-Name: value`
3. Example:

```text theme={null}
X-API-Key: YOUR_API_KEY
X-Environment: production
X-Project: my-site
```

***

## Troubleshooting

<Accordion title="No data appearing in dashboard">
  1. **Verify the drain is active** - Check the Drains page in Vercel settings
  2. **Check the API key** - Ensure the `X-API-Key` header is set correctly
  3. **Test the connection** - Use the Test button in the drain settings
  4. **Check log sources** - Ensure Static Files, Edge Functions, and Functions are selected
  5. **Verify Production environment** - Make sure Production is selected in log sources
</Accordion>

<Accordion title="Test returns an error or 401 Unauthorized">
  1. Verify the endpoint URL is exactly `https://ingest.chatfeatured.com/v1/logs/vercel`
  2. Ensure the format is set to **NDJSON** (not JSON)
  3. Check that your API key is valid and active
  4. Try generating a new API key in ChatFeatured if the current one isn't working
</Accordion>

<Accordion title="Some requests not appearing in analytics">
  1. Ensure **Production** environment is selected
  2. Check that **sampling is set to 100%** (reducing sampling will skip logs)
  3. Verify that the relevant log sources are checked (Static Files, Edge Functions, Functions)
  4. Wait 2-3 minutes for logs to process and appear in the dashboard
</Accordion>

<Accordion title="Drain shows 'Inactive' or 'Error' status">
  1. Click on the drain to view error details
  2. Re-test the connection using the Test button
  3. Verify your endpoint URL and API key haven't changed
  4. If the error persists, try removing and recreating the drain
</Accordion>

<Accordion title="High log volume or performance impact">
  1. Verify that NDJSON format is being used (not JSON, which is less efficient)
  2. Reduce sampling rate if you have extremely high traffic (note: this will lose data)
  3. Filter to specific projects if you don't need all projects tracked
  4. Contact Vercel support if you're experiencing performance issues
</Accordion>

<Accordion title="API Key has expired or been rotated">
  1. Generate a new API key in ChatFeatured
  2. Go to your Vercel Log Drain settings
  3. Update the `X-API-Key` header with the new key
  4. Click **Test** to verify the connection
  5. Save the changes
</Accordion>

***

## Best Practices

### Setup & Configuration

* Use dedicated API keys for each integration
* Test the connection before finalizing setup
* Start with production projects before adding non-production
* Monitor your Vercel dashboard for drain status

### Monitoring & Maintenance

* Regularly check your Agent Analytics dashboard for data flow
* Rotate API keys periodically from ChatFeatured settings
* Archive old data if you need to free up quota

### Optimization

* Use project filtering if you have many Vercel projects
* Keep sampling at 100% for accurate bot tracking
* Review log sources to match your tracking needs

***

## Performance Notes

**Setup Latency:**

* No impact on your site performance (drains don't block requests)
* Log delivery to ChatFeatured happens asynchronously

**Log Delivery:**

* Real-time streaming (logs appear in ChatFeatured within seconds)
* NDJSON format optimizes for throughput

**Throughput:**

* Can handle high-volume production sites
* Scales automatically with your Vercel plan

***

## Security & Best Practices

### API Key Management

* Create a dedicated API key for Vercel (don't reuse keys)
* Rotate keys periodically from the ChatFeatured dashboard
* Revoke keys immediately if you suspect compromise
* Never commit keys to version control or public repositories

### Data Privacy

* Only request metadata is logged (no page content or user data)
* IP addresses are used for geographic aggregation only
* All data is transmitted over HTTPS
* ChatFeatured is GDPR compliant

***

## Pricing

Vercel Log Drains availability by plan:

| Plan       | Log Drains    |
| ---------- | ------------- |
| Hobby      | Not available |
| Pro        | Included      |
| Enterprise | Included      |

<Warning>
  Log Drains require a Vercel Pro or Enterprise plan. If you're on the Hobby plan, consider using our [Cloudflare integration](/integrations/cloudflare) instead.
</Warning>

***

## Next Steps

Once your Vercel integration is set up:

1. **Monitor your dashboard** - Check Agent Analytics to see AI crawler activity
2. **Track citations** - See which pages AI models cite in their responses
3. **Optimize content** - Use insights to improve AI visibility for high-traffic pages
4. **Correlate with performance** - Compare AI traffic patterns with your site metrics

For more information on using Agent Analytics, see [Setting up Agent Analytics](/using-chatfeatured/agent-analytics).

***

## See Also

* [Cloudflare Integration](/integrations/cloudflare) — Alternative for non-Vercel hosting
* [Agent Analytics](/using-chatfeatured/agent-analytics) — Understanding your data
