Custom Domain using Cloudflare

You might want to route your analytics traffic through your own domain. This will lead to fewer DNS lookups as well as prevent AdBlockers from blocking it.

If you are using Next.js we recommend using the Next.js Proxy instead. We also offer an easier method for Netlify users.


1. Create a new Cloudflare Worker

  • Click on the Workers tab & Create a new worker
Create Cloudflare Worker
Cloudflare Worker section
Paste in Cloudflare Worker proxy script
Adding the script
  • Click on "Save and Deploy"

✅ Your worker is now available under

You can already use as a custom domain in your script.

After deploying the worker, you need to navigate to one domain of your choice managed by Cloudflare.

  • Choose the "Workers" tab in the menu
  • Press Add route
  • Add the domain followed by /* you want the worker to be available at. In this example we are using Our route would be:*
    Just select the previously generated worker in the dropdown.
Add the Cloudflare worker route correctly
Mapping the route to the previously generated worker

Last, we need to link the subdomain to a random IP. Navigate to DNS and create a new A record

Create DNS record
Create DNS record

Done! The new worker is available under (not yours)

3a. Use the custom domain in the script tag

To use your custom domain, just replace the Splitbee script tag with:

<script async src=""></script>

In our example,, it would work like this:

<script async src=""></script>

3b. Using the JavaScript Library

In the init from our @splitbee/web library, you can provide the URL to the proxied script.

scriptUrl: ""

You can confirm by checking the DevTools network tab that all traffic indeed flows through your domain.