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:
| Field | Value |
|---|---|
| Type | CNAME |
| Name | track |
| Target | script.leadboxer.com |
| Proxy status | Proxied (orange cloud ☁️) |
You can use any subdomain name you like —
track,pixel,t, etc.
Step 2 — Create a Cloudflare Worker
- In your Cloudflare dashboard, go to Workers & Pages → Create
- Choose Create Worker
- Give it a name (e.g.
leadboxer-proxy) - 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,
});
}
};- Click Deploy
Step 3 — Add a Worker Route
- Go to Workers & Pages → your Worker → Settings → Triggers
- Under Routes, click Add Route
- Enter the following:
| Field | Value |
|---|---|
| Route | track.yourdomain.com/* |
| Zone | Your domain |
- Click Save
Replace
track.yourdomain.comwith 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.
Updated 2 days ago
