> For the complete documentation index, see [llms.txt](https://docs.airops.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.airops.com/insights/onsite/traffic/netlify-agent-analytics.md).

# Netlify

Connect your Netlify site to AirOps to track AI bot traffic via Netlify Log Drains.

Connect your Netlify site to AirOps to track AI bot traffic. You add a **Netlify Log Drain** that streams edge traffic logs to AirOps, which classifies AI bot visits (ChatGPT, Claude, Perplexity, Google, and more) and surfaces insights in your Agent Analytics dashboard.

Setup is a one-time manual step in the Netlify dashboard. Log Drains are a **Netlify Enterprise** feature. No site tag or client-side script is required.

***

## Prerequisites

* An active **AirOps** account with Agent Analytics enabled
* A **Netlify Enterprise** account (Log Drains are not available on Free, Personal, or Pro plans)
* A **Netlify site** serving your website
* A **Brand Kit** in AirOps for that site. Set its Brand URL to your site's domain so page-level breakdowns resolve (configurable under Context > Brand Kits > Brand URL)

If you're not sure whether your brand kit is set up correctly, check with your AirOps Customer Success contact before setting up the drain.

***

## Step 1: Get your AirOps endpoint and token

In AirOps, open **Insights → Onsite → Agent Analytics**, click **Set up Agent Analytics** and choose **Netlify**. The panel shows both values you need:

* the **ingest endpoint URL** for your brand kit
* your **workspace API token**, hidden by default. Click **Show** to reveal it, or **Copy** to copy it straight to your clipboard.

The token is the `Authorization: Bearer` value in Step 2.

{% hint style="info" %}
If the token isn't shown, your role doesn't have access to the workspace API key. Ask a workspace admin.

You can also assemble the endpoint yourself: `https://ingest.airops.com/api/v1/netlify/<YOUR_BRAND_KIT_ID>/ingest`. Your Brand Kit ID is in the URL under Context > Brand Kits, in the form `https://app.airops.com/<YOUR_WORKSPACE_SLUG>/data/brand_kits/<YOUR_BRAND_KIT_ID>`. The token also lives under Settings > Workspace.
{% endhint %}

<figure><img src="https://3762890407-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FX2n5yPRPynbnWuO4SH0M%2Fuploads%2Fgit-blob-5368cd65ba16a0cb5b6fe548d7e1ec5ee4e272a4%2Fagent-netlify-01-setup-panel.png?alt=media" alt="Set up Agent Analytics panel for Netlify with the ingest endpoint URL and workspace API token to copy"><figcaption><p>Copy the AirOps values for the Netlify setup.</p></figcaption></figure>

## Step 2: Add a Log Drain in Netlify

In Netlify, go to your team's **Logs & Metrics > Log Drains > Add log drain**, then:

1. **Service:** General HTTP endpoint
2. **Log types:** Traffic only (leave function, edge, deploy, and firewall logs off)
3. **Format:** NDJSON
4. **Endpoint URL:** the AirOps endpoint from Step 1
5. **Header:** add `Authorization: Bearer <your token>`
6. **Exclude PII:** leave this **off** (see the warning below)
7. Click **Connect** to save the drain.

{% hint style="warning" %}
Leave **"Exclude PII" off**. Netlify's PII-exclusion option drops the User-Agent and client IP from traffic logs. AirOps identifies AI agents from the User-Agent, so with PII excluded no bot traffic can be classified and your dashboard stays empty. Keep it off for Agent Analytics.
{% endhint %}

## Step 3: Verify the Connection

Back in AirOps, reopen **Set up Agent Analytics** and choose **Netlify**, then click **I've set this up**. Netlify now shows a green **Connected** badge in the source list.

Your drain is live as soon as Netlify accepts it, and traffic appears in the dashboard as AI agents crawl your tracked pages.

{% hint style="info" %}
Test with a real, existing path on your site. Requests to non-existent pages can be served from Netlify's edge cache without reaching the drain, so a 404 test won't produce data. Also confirm the drain's log type is set to **Traffic**.
{% endhint %}

***

## Troubleshooting

| Symptom                                                       | Likely Cause                                               | Fix                                                                                                                               |
| ------------------------------------------------------------- | ---------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| Can't see the **I've set this up** button                     | Your role can't edit brand kits                            | Ask a workspace admin to confirm the connection for you.                                                                          |
| Drain saved in Netlify but no data appears in Agent Analytics | No AI bot has hit the site yet, or "Exclude PII" is on     | Confirm real traffic is reaching the site, and turn off "Exclude PII" on the drain.                                               |
| Raw traffic shows up but nothing is classified                | "Exclude PII" is on, so the User-Agent is missing          | Edit the drain in Netlify and turn off PII exclusion. AirOps needs the User-Agent to identify bots.                               |
| Page-level data is missing in Page360                         | Your brand kit's domain doesn't match the site             | In AirOps, open Brand Kit settings and confirm the Brand URL matches the domain your Netlify site serves.                         |
| Drain configured but no rows after a few minutes              | You tested a path that 404s, or the log type isn't Traffic | Visit a known-good path that exists in your deployment, and confirm the drain's log type is **Traffic** (not function/edge only). |
| Can't find Log Drains in Netlify                              | Your team is not on an Enterprise plan                     | Log Drains require **Netlify Enterprise**. Upgrade before setting up.                                                             |

***

## Plan Requirements

Netlify Log Drains are available on the **Netlify Enterprise** plan only. Free, Personal, and Pro plans cannot create drains; your team needs Enterprise before setting this up.

Netlify does not publish a separate per-GB charge for Log Drain egress; any data cost is part of your Netlify Enterprise agreement. To keep volume down, drain **Traffic logs only**.

***

## Security and least-privilege setup

### Permissions required to set up

**On Netlify:** a team member able to manage Log Drains on your Enterprise team can add the drain.

**On AirOps:** the user must be signed in to AirOps and a member of the target workspace; any AirOps role works.

### Runtime authentication

No user session is involved in any drain delivery. Each delivery authenticates with a **Bearer token** in the `Authorization` header, which is your **workspace's AirOps API key**, entered into the drain configuration during setup. The token is workspace-level, not user-level. There is no separate signing secret to manage.

### Token rotation

The workspace API key is rotatable in-app under **Account > Workspace > API Key** (requires AirOps workspace admin role). Two things to understand before rotating:

* The Netlify drain has the previous token in its outbound `Authorization` header. After rotation, update the drain's header in Netlify with the new token, otherwise deliveries will start failing authentication.
* The same workspace API key authenticates other AirOps APIs (Public API, MCP server, SDK). Rotating it affects all of those, not only Netlify.

### What this integration does not do

* It only receives the traffic logs the drain sends. It has no access to your Netlify account, environment variables, build logs, or deploys.
* It does not write back to your Netlify account. After setup, AirOps only receives data from the drain.

If your security review needs additional detail, contact AirOps Customer Success and we can walk your team through the data flow at the implementation level.

***

## Disconnecting

To remove the Netlify integration:

1. In Netlify, open **Logs & Metrics > Log Drains** and remove the AirOps drain.
2. In AirOps, disconnect **Netlify** from the data-source picker.

Your historical Netlify data stays in AirOps after disconnecting. To resume tracking, set the drain up again.

***

## What AirOps Tracks

Once connected, AirOps automatically:

* **Ingests all Netlify-served requests** carried in the traffic logs: page views, assets, API calls
* **Classifies AI bot traffic:** identifies visits from ChatGPT, Claude, Google, Perplexity, Meta, Apple, Bing, Bytedance, Common Crawl, and others
* **Categorizes crawl behavior:** distinguishes AI training crawlers (GPTBot, ClaudeBot, etc.), AI search fetches (PerplexityBot, OAI-SearchBot, etc.), and user-initiated AI browsing (ChatGPT-User, Claude-User, etc.)
* **Surfaces analytics:** traffic breakdowns, bot-vs-human ratios, and crawl trends in your dashboard


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.airops.com/insights/onsite/traffic/netlify-agent-analytics.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
