> ## 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 Cloudflare

## Prerequisites

* An active Writesonic account
* Admin access to your Cloudflare website
* Your website must be using Cloudflare (if you're not, see alternative options below)

### Phase 1: Start in Writesonic

1. Head over to the [AI Traffic Analytics page](https://app.writesonic.com/geo/ai-traffic-analytics) on Writesonic

2. Click on **"Set Up Cloudflare Integration"**

   <img src="https://mintcdn.com/writesonic/58yCcA4iOuLjtoVe/images/docs/9fb5e6073e9f395ac9b15408b225b35e9ca9321aa76dfb8f94eae9c27a564c43-CleanShot_2025-03-02_at_23.49.372x.png?fit=max&auto=format&n=58yCcA4iOuLjtoVe&q=85&s=2659e0674c1ba82610fc88ded254501e" alt="" width="3084" height="1842" data-path="images/docs/9fb5e6073e9f395ac9b15408b225b35e9ca9321aa76dfb8f94eae9c27a564c43-CleanShot_2025-03-02_at_23.49.372x.png" />

3. You'll see a modal like this appear on the screen. Now, you need to head over to your Cloudflare account and set up an API key.

   <img src="https://mintcdn.com/writesonic/d8tibQs3wr_nKdrf/images/docs/907967ad256438c70e612168b69cb9210bf84ecd94d968daf75093049c7a5261-CleanShot_2025-03-02_at_00.23.462x.png?fit=max&auto=format&n=d8tibQs3wr_nKdrf&q=85&s=a89adbde726ff02f065e7c2fc16b149e" alt="" width="1132" height="1582" data-path="images/docs/907967ad256438c70e612168b69cb9210bf84ecd94d968daf75093049c7a5261-CleanShot_2025-03-02_at_00.23.462x.png" />

### Phase 2: Ensure Proper Cloudflare Proxy Settings

In your Cloudflare DNS settings, ensure the orange cloud icon is turned ON for your domain records (indicating "Proxied" status).

For AI Traffic Analytics to work properly, the orange cloud proxy toggle must be enabled as shown in the image below. This allows Cloudflare to properly intercept and record AI crawler traffic.

<img src="https://mintcdn.com/writesonic/_57TF2fFQoTtAfH5/images/docs/c882fb13114bdea52c8939eb8387615e6c58407332f3542b469aec06a372f8c4-CleanShot_2025-03-03_at_00.53.382x.png?fit=max&auto=format&n=_57TF2fFQoTtAfH5&q=85&s=75fffb2ccedb06a4a9202ccd384bc98b" alt="" width="2190" height="660" data-path="images/docs/c882fb13114bdea52c8939eb8387615e6c58407332f3542b469aec06a372f8c4-CleanShot_2025-03-03_at_00.53.382x.png" />

### Phase 3: Create API Token in Cloudflare

1. Go to the [API Tokens page](https://dash.cloudflare.com/profile/api-tokens) on your Cloudflare dashboard.

2. Click on `Create Token`

   <img src="https://mintcdn.com/writesonic/_57TF2fFQoTtAfH5/images/docs/c990f8578927c695570528f2289355a16ec1d721e06960daa4df91024a1ebd44-CleanShot_2025-03-03_at_00.07.052x.png?fit=max&auto=format&n=_57TF2fFQoTtAfH5&q=85&s=74ce57fe229412f900d913a5834c05c9" alt="" width="3010" height="1776" data-path="images/docs/c990f8578927c695570528f2289355a16ec1d721e06960daa4df91024a1ebd44-CleanShot_2025-03-03_at_00.07.052x.png" />

3. Click the `Use Template` button next to **"Edit Clouldflare Workers"**.

   <img src="https://mintcdn.com/writesonic/X3wiRgE7vzfy9Z8A/images/docs/05cbad142f8c78922a728a7aed8c67309542bb3c3504fd244a69a2dd0291790e-CleanShot_2025-03-03_at_00.10.152x.png?fit=max&auto=format&n=X3wiRgE7vzfy9Z8A&q=85&s=97daf956e79382677eba9a2c5e962082" alt="" width="2978" height="1626" data-path="images/docs/05cbad142f8c78922a728a7aed8c67309542bb3c3504fd244a69a2dd0291790e-CleanShot_2025-03-03_at_00.10.152x.png" />

### Phase 4: Configure Token Permissions

1. On the next screen, scroll down to "Permissions".

   <img src="https://mintcdn.com/writesonic/dn64fE971vqZNBuD/images/docs/7b05e1129c59daf0b6757659402cfd666bedfe5ed31ee1328247302789d31a01-CleanShot_2025-03-03_at_00.24.542x.png?fit=max&auto=format&n=dn64fE971vqZNBuD&q=85&s=58b6e925a4b197fa9f40f296eed5c532" alt="" width="1904" height="1082" data-path="images/docs/7b05e1129c59daf0b6757659402cfd666bedfe5ed31ee1328247302789d31a01-CleanShot_2025-03-03_at_00.24.542x.png" />

   Click on the cross buttons to remove all permissions apart from **"Worker Routes"** and **"Worker Scripts"**. It should look like this:

   <img src="https://mintcdn.com/writesonic/XApYKGBzZAYXfqsx/images/docs/5c2db5de5e5120272f1723e83ae81a517025af4244369518fae7c35ced8808b7-CleanShot_2025-03-03_at_00.25.202x.png?fit=max&auto=format&n=XApYKGBzZAYXfqsx&q=85&s=d866af157ca6f9ac4b2f7a8bcfe09604" alt="" width="2114" height="784" data-path="images/docs/5c2db5de5e5120272f1723e83ae81a517025af4244369518fae7c35ced8808b7-CleanShot_2025-03-03_at_00.25.202x.png" />

2. Scroll down and select your Cloudflare account under the **"Account Resources"** dropdown.

   <img src="https://mintcdn.com/writesonic/_57TF2fFQoTtAfH5/images/docs/e4c926acfff7a18aeb30f2c61d7c50df22df28a5d0df236dc8a1c23bbe3a1b81-CleanShot_2025-03-03_at_00.12.122x.png?fit=max&auto=format&n=_57TF2fFQoTtAfH5&q=85&s=59f3c5ba58f028e825f1ed4f91e4920c" alt="" width="2982" height="1778" data-path="images/docs/e4c926acfff7a18aeb30f2c61d7c50df22df28a5d0df236dc8a1c23bbe3a1b81-CleanShot_2025-03-03_at_00.12.122x.png" />

3. Additionally, choose the domain that you would like to install the analytics on from the **"Zone Resources"** dropdown.

   <img src="https://mintcdn.com/writesonic/mL2PcCVqj70X1MZv/images/docs/e86f3ee33b9f3c60e0919abb064b376a62f5f6ccfdf94a226f411ce7a964e811-CleanShot_2025-03-03_at_00.15.402x.png?fit=max&auto=format&n=mL2PcCVqj70X1MZv&q=85&s=4e273f8d79412edb7fcc272c4659b336" alt="" width="2972" height="1688" data-path="images/docs/e86f3ee33b9f3c60e0919abb064b376a62f5f6ccfdf94a226f411ce7a964e811-CleanShot_2025-03-03_at_00.15.402x.png" />

### Phase 5: Create and Copy Token

1. Click on **"Continue to Summary"**.

2. And then click on **"Create Token"**.

   <img src="https://mintcdn.com/writesonic/XApYKGBzZAYXfqsx/images/docs/6047515fb3a790eec3174edec9c3db1c2f43138326279369139ecd2f862d180f-CleanShot_2025-03-03_at_00.18.482x.png?fit=max&auto=format&n=XApYKGBzZAYXfqsx&q=85&s=1f2ffd79b4555a9495cfb7677d059fda" alt="" width="2994" height="1392" data-path="images/docs/6047515fb3a790eec3174edec9c3db1c2f43138326279369139ecd2f862d180f-CleanShot_2025-03-03_at_00.18.482x.png" />

3. Next, click on the "Copy" button to copy your API token.

   <img src="https://mintcdn.com/writesonic/d8tibQs3wr_nKdrf/images/docs/836ad1bbb4288a737e489d8e00b4852526479ba389e17e75299c6a33bd207217-CleanShot_2025-03-03_at_00.20.102x.png?fit=max&auto=format&n=d8tibQs3wr_nKdrf&q=85&s=789af28eba93e5e3879a9a9051ab70bd" alt="" width="3004" height="1594" data-path="images/docs/836ad1bbb4288a737e489d8e00b4852526479ba389e17e75299c6a33bd207217-CleanShot_2025-03-03_at_00.20.102x.png" />

### Phase 6: Complete Setup in Writesonic

1. Now, go back to Writesonic. Enter your copied API token and click on **"Continue"**.

<img src="https://mintcdn.com/writesonic/c7y82ZhEtYaeYDpv/images/docs/2df6f32494ba2151a7cb8e03f2e360141bf7814763f12b105df90d02703dd049-CleanShot_2025-03-03_at_00.21.372x.png?fit=max&auto=format&n=c7y82ZhEtYaeYDpv&q=85&s=9e45e9688203a1095ae96eeb26f43daa" alt="" width="1102" height="1594" data-path="images/docs/2df6f32494ba2151a7cb8e03f2e360141bf7814763f12b105df90d02703dd049-CleanShot_2025-03-03_at_00.21.372x.png" />

2. On the next screen, some of the values should be prefilled.

   Make sure that:

   1. the correct account is showing under Cloudflare Account.

   2. Correct domain is selected under Cloudflare Zone.

   3. Route Path should be `(subdomain).example.com/*` if your Cloudflare Zone is `example.com`.

      > **NOTE:** **The wildcard character is not allowed in the subdomain.** **Adding a subdomain is optional.**

      <img src="https://mintcdn.com/writesonic/nTROtF1WuUqhx9V0/images/docs/33d1a1663cbea0ac76823922e0c6520ec311d974626472b6b0428c6c82f79507-CleanShot_2025-03-04_at_18.19.042x.png?fit=max&auto=format&n=nTROtF1WuUqhx9V0&q=85&s=eed3c9216b1c80a4620f9a06a0948320" alt="" width="900" height="1304" data-path="images/docs/33d1a1663cbea0ac76823922e0c6520ec311d974626472b6b0428c6c82f79507-CleanShot_2025-03-04_at_18.19.042x.png" />

3. Click on the Finish button and your Analytics should be deployed in a couple of seconds.

<img src="https://mintcdn.com/writesonic/iNIgGEoh_nUcRO7A/images/docs/c46c50b71f803dc395851bde7b8e9df032658fa80aabf16cdab35396fcca0a6b-CleanShot_2025-03-03_at_00.31.112x.png?fit=max&auto=format&n=iNIgGEoh_nUcRO7A&q=85&s=ce9166783f2756c6c521d9caaf3bee41" alt="" width="3308" height="1730" data-path="images/docs/c46c50b71f803dc395851bde7b8e9df032658fa80aabf16cdab35396fcca0a6b-CleanShot_2025-03-03_at_00.31.112x.png" />

### Verify Installation

To test if the Analytics has been set up properly, go to ChatGPT and with **GPT-4o** model selected with "Search" enabled, try running a query like:

```
Research and tell me about yourwebsite.com.
```

where `yourwebsite.com` should be replaced with your website domain.

Now, go back to Writesonic and you should start seeing the requests on your Analytics.

## Alternative Implementation Methods

Additionally, we support native integrations to Wordpress and Vercel. We are coming up with various other integrations like Shopify, Webflow, Python, Javascript, etc.

## Troubleshooting

If you encounter any issues during setup:

* Ensure your Cloudflare account has the correct permissions
* Check that your selected domain is active in Cloudflare
* Verify that no conflicting Workers are running
* For assistance, contact [\[email protected\]](/cdn-cgi/l/email-protection#77040207071805033700051e03120418191e145914181a)

For more detailed debugging, please check out the [Toubleshooting and FAQs](https://docs.writesonic.com/docs/ai-traffic-analytics-troubleshooting-and-faqs#/) page.

***

[Setup and Implementation Guide](/docs/ai-traffic-analytics-setup-and-implementation-guide)

[Integrating with Wordpress](/docs/integrating-with-wordpress)
