Skip to content

Serve the script from your own domain

Point a subdomain at Statsy and the script and its beacons become first-party, so ad blockers leave them alone.

By default the script is served from https://statsy.co, and some ad blockers block requests to any analytics host. A proxy host puts the script and its beacons on a subdomain of your own site instead, which blockers treat as first-party.

Set it up

  1. Add a DNS record

    Create a CNAME from the subdomain you want to the Statsy proxy endpoint.

    text
    s.yourstartup.com.  CNAME  proxy.statsy.co.
  2. Save the hostname in Statsy

    Open Site settings › Tracking › Proxy host, enter the same hostname, and save.

  3. Update the tag

    Change the src on your tag to the proxy host. Nothing else about the snippet changes, and the install screen prints the new version for you.

    html
    <script defer data-website-id="ws_XXXXXXXX" data-domain="yourstartup.com" src="https://s.yourstartup.com/js/script.js"></script>

Certificates are automatic

A certificate is issued for your hostname on its first request, once the DNS record resolves. It only happens for hostnames a site has actually registered, which is why the settings entry and the DNS record both have to exist. Save the hostname before you point traffic at it.

What changes, and what does not

The script sends its beacons to the origin it was loaded from, so serving it from s.yourstartup.com moves both the script download and the data collection onto your domain. Your site key, your reports and your cookies are unchanged: the visitor cookie was always first-party.

Watch out. Update your Content Security Policy at the same time. A policy that only allows https://statsy.co will block the proxy host.

Sending data somewhere else

The data-proxy attribute sets the origin beacons are posted to, independently of where the script file came from. Most sites do not need it: set the proxy host, change the src, and both follow.

Last updated · Markdown version