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

# Integrating With Fastly Log Streaming

> This guide walks you through the process of implementing AI Bot Analytics on your website using Fastly's realtime log streaming.

## Prerequisites

* An active Writesonic account
* A Fastly CDN Service configured for your website
* Access/permission to edit Logging Endpoints in Fastly

## Phase 1: Start in Writesonic

1. Head over to the **AI Bot Analytics** page on Writesonic and choose ‘Fastly’ as a provider
2. Click on ‘Continue’ to initialize the integration.

<img src="https://mintcdn.com/writesonic/58yCcA4iOuLjtoVe/images/docs/a4c634a92ab50eb48e9b6740b5a3e4a8e633cb2e10c54eed43ffd32cbf10154a-fastly_first_image.webp?fit=max&auto=format&n=58yCcA4iOuLjtoVe&q=85&s=300c73697229390e708677d84a2130b1" alt="" width="1832" height="1016" data-path="images/docs/a4c634a92ab50eb48e9b6740b5a3e4a8e633cb2e10c54eed43ffd32cbf10154a-fastly_first_image.webp" />

3. Writesonic will generate the following information that you'll need during the Fastly configuration:

* Log Format
* Endpoint URL
* Custom Header Value

## Phase 2: Get Your Fastly Service ID

1. Log in to your Fastly dashboard
2. Navigate to your CDN Service for which you want to configure AI Bot Analytics
3. Copy the **Fastly Service ID** from your service dashboard

<img src="https://mintcdn.com/writesonic/nTROtF1WuUqhx9V0/images/docs/385be12a0bc7036c90ef33fdc0ec7a6fdbcbce5d9ac7c876d3020dc2ff707620-image.png?fit=max&auto=format&n=nTROtF1WuUqhx9V0&q=85&s=76ecb11a2909b81e7fad300f7d31520f" alt="" width="2610" height="1304" data-path="images/docs/385be12a0bc7036c90ef33fdc0ec7a6fdbcbce5d9ac7c876d3020dc2ff707620-image.png" />

4. Return to Writesonic and paste the Service ID there and click “Submit”.

<img src="https://mintcdn.com/writesonic/_57TF2fFQoTtAfH5/images/docs/d5b1d6104809abb94ff7ea84f22919585098abab36ce26cdd3f943080f6c2449-image.png?fit=max&auto=format&n=_57TF2fFQoTtAfH5&q=85&s=55e4b4ec4662b19faa7d757cf63e7f92" alt="" width="1796" height="780" data-path="images/docs/d5b1d6104809abb94ff7ea84f22919585098abab36ce26cdd3f943080f6c2449-image.png" />

5. Click on “Continue” to proceed to the next step.

## Phase 3: Configure Logging in Fastly

### Step 1: Navigate to Logging Configuration

1. In your Fastly CDN Service, navigate to: **"Service Configuration"** > **"Logging"** > **"Create endpoint"** > **"HTTPS" > “Create endpoint”**

<img src="https://mintcdn.com/writesonic/_57TF2fFQoTtAfH5/images/docs/d68d79a7be0a22054c2eb126abc2867d0027f3c58fff406db7acabb5f05f24e0-image.png?fit=max&auto=format&n=_57TF2fFQoTtAfH5&q=85&s=19bf8e20d60158f84725b0e8a5055616" alt="" width="2588" height="1142" data-path="images/docs/d68d79a7be0a22054c2eb126abc2867d0027f3c58fff406db7acabb5f05f24e0-image.png" />

### Step 2: Configure the HTTPS Logging Endpoint

1. **Name**: Give a name to your logging endpoint (e.g. Fastly Log Streaming).
2. **Log Format**: Copy the Log Format from Writesonic and paste it in the ‘Log Format’ field in Fastly
3. **URL**: Copy the Endpoint URL from Writesonic and paste it in the **'URL'** field in Fastly

<img src="https://mintcdn.com/writesonic/nTROtF1WuUqhx9V0/images/docs/43c1a0d37d42905927641e33171ad50ed0798f48df95e2b57610133bda9fb396-image.png?fit=max&auto=format&n=nTROtF1WuUqhx9V0&q=85&s=7e7c316ec8545d3e44764e7072771e2d" alt="" width="1410" height="1252" data-path="images/docs/43c1a0d37d42905927641e33171ad50ed0798f48df95e2b57610133bda9fb396-image.png" />

### Step 3: Configure Advanced Options

Navigate to **Advanced options** and set the following:

1. **Content Type**: Set to `application/json`
2. **Custom Header Key**: Set to `x-api-key`
3. **Custom Header Value**: Copy the value from Writesonic and paste it there

<img src="https://mintcdn.com/writesonic/d8tibQs3wr_nKdrf/images/docs/9311bbe514ab1e0f8ea4534836a436df319e13e0dcf728f1bec6c3f817f49f4a-image.png?fit=max&auto=format&n=d8tibQs3wr_nKdrf&q=85&s=c91c61e3773c3f4289123b08f6b70058" alt="" width="1444" height="644" data-path="images/docs/9311bbe514ab1e0f8ea4534836a436df319e13e0dcf728f1bec6c3f817f49f4a-image.png" />

> Rest of the fields in the configuration are optional and can be left as such

### Step 4: Create and Activate

1. Click **'Create'** and wait for the configuration to be applied
2. Once the configuration is ready, click **'Activate'** to finalize the setup

## Phase 4: Verify Installation in Writesonic

1. Wait for 5-10 minutes for Logging Endpoint to activate.
2. Return to AI Bot Analytics Page in Writesonic.
3. Click on **"Verify Integration"** to confirm that your Fastly integration is working properly
4. Once verified, you'll be redirected to your analytics dashboard. The process typically finishes in 1–2 minutes but may take up to 5 minutes.

## Understanding the Integration

This integration works by:

1. **Traffic Capture**: Fastly captures all incoming requests to your website
2. **Log Formatting**: The custom log format extracts relevant information about AI crawler requests
3. **Real-time Streaming**: Logs are streamed in real-time to Writesonic's analytics endpoint
4. **AI Detection**: Writesonic processes the logs to identify and analyze AI Bot traffic

## Troubleshooting

If you encounter any issues during setup:

* **Service ID Issues**: Ensure you've copied the correct Fastly Service ID
* **Configuration Problems**: Verify that the log format, endpoint URL, and headers are copied exactly as provided
* **Activation Delays**: Allow a few minutes for Fastly configuration changes to propagate
* **Missing Data**: Check that your website is receiving traffic and that the logging endpoint is properly configured
* **Header Authentication**: Confirm that the `x-api-key` header value matches exactly what Writesonic provided
* Make sure to ‘Activate’ the logging configuration after it’s been created/updated.

For assistance, contact [\[email protected\]](/cdn-cgi/l/email-protection#16656366667964625661647f62736579787f753875797b)

## Managing the Integration

### Modifying the Configuration

To modify your Fastly logging configuration:

1. Navigate back to **Service Configuration > Logging > Edit Configuration**
2. Find your Writesonic endpoint
3. Update the logging configuration and click ‘Update’
4. Don't forget to **"Activate"** your changes

***

[Integrating with Drupal](/docs/integrating-with-drupal)

[Integrating with Custom Log Drain](/docs/integrating-with-custom-log-drain)
