Docs·Proxy guide
Managed proxy
We run the proxy and its HTTPS certificate. You pick a subdomain and add one DNS record. It's on every plan, free included.
Pick a subdomain
In Spreelytics, go to Settings → Tracking script → Managed proxy. Enter a subdomain of your site
that you don't use yet, like a.example.com, and select Enable.
Pick a plain name. Names like analytics, tracking or stats are on ad blockers' lists. It has to
be a subdomain: a CNAME record can't sit on example.com itself.
Add the CNAME record
Settings shows the record to add. Add it where you manage your domain's DNS:
| Type | Name | Value |
|---|---|---|
CNAME | a | the value shown in Settings |
If your DNS is on Cloudflare, set the record to DNS only (grey cloud), not proxied.
Settings checks the record while the page is open. Once it's found, we issue the certificate and the status turns Active, usually within a few minutes.
Update the script tag
When it's active, Settings shows your snippet with the new address. Replace the one on your site:
<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>
The old snippet keeps working, so pages you haven't updated yet still count.
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.
401: theOriginandRefererheaders didn't arrive, or your domain isn't in Allowed domains.- Not active, or still blocked: see If it doesn't turn active.
If it doesn't turn active
- Pending for a long time: the record isn't there yet, or points somewhere else. Check its name and value, and that it's DNS only on Cloudflare. A record left out for 7 days stops the setup: remove the subdomain in Settings and enable it again.
- Error: Settings says why. A CAA record on your domain can block the certificate: allow
letsencrypt.organdpki.goog, or remove the CAA record, then select Check status. If you removed the CNAME later, add it back within 7 days. - Still blocked: some blockers also block by name. Pick a plainer subdomain.
- Content Security Policy: allow your subdomain in
script-srcandconnect-src.
Remove it
Put the normal snippet back on your site first, then select Remove in Settings. Pages still loading the script from your subdomain stop counting once it's removed.
Related
- Proxy overview: the other ways to set it up.
- Script tag:
api_hostand every other option.