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.

RegistryImage
GitHub Container Registryghcr.io/spreelytics/tracking-proxy:1
Docker Hubspreelytics/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 200 and nothing arrives: the proxy isn't passing the visitor's IP address in X-Forwarded-For. See the note below.
  • 401: the Origin and Referer headers didn't arrive, or your domain isn't in Allowed domains.
  • Content Security Policy: if your site has one, allow a.example.com in script-src and connect-src.

See your own numbers today.

Free up to 1M events a month · no credit card

Contact

Tell us what you need.

A real person reads these. We usually reply within one working day.

Or email us directly at contact@spreelytics.com.