White-Labeling the Tracking Script

Serve the LeadBoxer tracking script from your own domain using Cloudflare Workers. This hides the LeadBoxer origin from visitors and reduces the chance of the script being blocked by ad blockers or privacy extensions.

Prerequisites

  • A domain managed by Cloudflare
  • Access to your Cloudflare dashboard
  • LeadBoxer dataset ID (found in your LeadBoxer account)

Overview

By default, the LeadBoxer script is loaded from script.leadboxer.com. This tutorial shows you how to proxy it through your own subdomain (e.g. track.yourdomain.com) so that visitors load it from your domain instead.

Before:  https://script.leadboxer.com/?dataset=YOUR_DATASET_ID
After:   https://track.yourdomain.com/?dataset=YOUR_DATASET_ID

Step 1 — Add a DNS Record

In your Cloudflare dashboard, go to DNS → Records and add the following:

FieldValue
TypeCNAME
Nametrack
Targetscript.leadboxer.com
Proxy statusProxied (orange cloud ☁️)

You can use any subdomain name you like — track, pixel, t, etc.


Step 2 — Create a Cloudflare Worker

  1. In your Cloudflare dashboard, go to Workers & Pages → Create
  2. Choose Create Worker
  3. Give it a name (e.g. leadboxer-proxy)
  4. Replace the default code with the following:
export default {
  async fetch(request) {
    const url = new URL(request.url);
    const upstreamUrl = "https://script.leadboxer.com" + url.pathname + url.search;

    const response = await fetch(upstreamUrl, {
      method: request.method,
      headers: request.headers,
      body: ["GET", "HEAD"].includes(request.method) ? undefined : request.body,
    });

    const newHeaders = new Headers(response.headers);
    newHeaders.delete("server");
    newHeaders.delete("x-powered-by");

    return new Response(response.body, {
      status: response.status,
      headers: newHeaders,
    });
  }
};
  1. Click Deploy

Step 3 — Add a Worker Route

  1. Go to Workers & Pages → your Worker → Settings → Triggers
  2. Under Routes, click Add Route
  3. Enter the following:
FieldValue
Routetrack.yourdomain.com/*
ZoneYour domain
  1. Click Save

Replace track.yourdomain.com with the subdomain you chose in Step 1.


Step 4 — Update Your Script Tag

On your website, replace the existing LeadBoxer script tag with your new proxied URL:

<!-- Before -->
<script defer="defer" src="https://script.leadboxer.com/?dataset=YOUR_DATASET_ID"></script>

<!-- After -->
<script defer="defer" src="https://track.yourdomain.com/?dataset=YOUR_DATASET_ID"></script>

Replace YOUR_DATASET_ID with your actual LeadBoxer dataset ID and track.yourdomain.com with your subdomain.


Verify It's Working

After deploying, open your browser's developer tools and check the Network tab. When your page loads, you should see a request to track.yourdomain.com returning a 200 response with Content-Type: text/javascript.

You can also visit the URL directly in your browser:

https://track.yourdomain.com/?dataset=YOUR_DATASET_ID

It should return the LeadBoxer tracking script content.


Notes

  • Scope: This setup only proxies the script load. Tracking events (pageviews, form submissions, etc.) are still sent directly from the visitor's browser to LeadBoxer's logging servers. This is expected behaviour.
  • SSL: Cloudflare handles HTTPS automatically — no additional certificate configuration is needed.
  • Caching: The LeadBoxer script is served with Cache-Control: no-cache. Cloudflare respects this, so visitors always receive the latest version of the script.
  • LeadBoxer ToS: Review LeadBoxer's terms of service to confirm that proxying the script is permitted for your account type.