First-Party Proxy Setup
By proxying the VeloStats tracking script and beacon endpoints through your own primary domain, you ensure 100% analytics coverage even when visitors use strict third-party tracker blockers.
Nginx Host Configuration
Add these proxy blocks to your website’s Nginx configuration:
# Serve tracker script as first-party
location = /stats/velo.js {
proxy_pass https://velostats.dev/velo.js;
proxy_set_header Host velostats.dev;
proxy_ssl_server_name on;
expires 1d;
}
# Proxy beacon ingestion
location /stats/api/ {
proxy_pass https://velostats.dev/api/v1/velo;
proxy_set_header Host velostats.dev;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_ssl_server_name on;
}
Cloudflare Worker Proxy
You can also use a lightweight Cloudflare Worker on a custom route such as /stats/*:
export default {
async fetch(request) {
const url = new URL(request.url);
const targetUrl = new URL(url.pathname.replace('/stats', ''), 'https://velostats.dev');
return fetch(new Request(targetUrl, request));
}
};