Docs·Proxy guide
Docker image
Our tracking proxy is a ready-made Docker image that serves the Spreelytics script and its tracking requests. Run it on any host that runs containers and give it a subdomain of your site. The source, and deploy examples for Kubernetes, Google Cloud Run, Fly.io and Render, are on GitHub at spreelytics/tracking-proxy.
| Registry | Image |
|---|---|
| GitHub Container Registry | ghcr.io/spreelytics/tracking-proxy:1 |
| Docker Hub | spreelytics/tracking-proxy:1 |
The :1 tag gets every update that keeps working with your snippet, so you don't have to change it.
Run it
Try it on your own machine first:
docker run -p 8080:8080 ghcr.io/spreelytics/tracking-proxy:1
Open http://localhost:8080. It says "Spreelytics proxy is running".
Then run the same image on your host. It listens on port 8080. The
repository has a ready-to-use setup for
Kubernetes, Google Cloud Run, Fly.io and Render; ECS, Azure Container Apps, Railway or any server with
Docker work the same way.
Give it a subdomain
Point a subdomain of your site at the proxy, with HTTPS. Pick a plain name like a.example.com or
cdn.example.com. Names like analytics or tracking are on blockers' lists.
Point the script at your proxy
<script src="https://a.example.com/cdn/sdk/spreelytics-loader.js"></script>
<script>
Spreelytics.init({
client_key: "YOUR_CLIENT_KEY",
api_host: "https://a.example.com/1.0",
});
</script>
Check it works
Open your site with the browser's Network tab open and filtered by a.example.com. The script files and
requests like track/page should come from your own domain, with status 200. In Spreelytics,
Settings → Tracking script says "Last seen just now" and Realtime shows you in your own country.
- Wrong country, or
200and nothing arrives: the proxy isn't passing the visitor's IP address inX-Forwarded-For. See the note below. 401: theOriginandRefererheaders didn't arrive, or your domain isn't in Allowed domains.- Content Security Policy: if your site has one, allow
a.example.cominscript-srcandconnect-src.
Related
- tracking-proxy on GitHub: the source, deploy examples and troubleshooting.
- Proxy overview: the other ways to set it up.
- Managed proxy: the same thing, run by us.