Managed reverse proxy
Route the Datasense script through your own subdomain with no server code: add a DNS record, update your script tag, and get past ad blockers.
Route Datasense through a subdomain you control without running proxy code. Datasense handles the routing, the SSL certificate and event collection.
Recommended for most sites. Use the managed proxy unless your app or web server already proxies requests. The proxy guide compares both.
Why use a proxy?
Ad blockers block known analytics domains. A subdomain of your own is much less likely to be blocked, which makes your numbers and your revenue attribution more complete. You don't need it to start: add it before a launch, or whenever you want the visitors ad blockers hide.
Without a proxy, your pages load the script from usedatasense.com and send events there. With the managed proxy, both go through your subdomain instead, such as a.yourdomain.com/js/script.cookies.js and a.yourdomain.com/api/e.
1. Enable the managed proxy
- Open your site's Settings → Ad blockers.
- Find Managed Proxy and enter a neutral subdomain such as
a.yourdomain.com. - Click Enable.
Pick a short subdomain that doesn't describe analytics:
a.yourdomain.comorcdn.yourdomain.comare good. Blocklists target names likeanalytics,trackingormetrics. Use a new subdomain, not the one your site runs on.
2. Add the DNS record
Settings shows the exact record to add at your DNS provider. For a.yourdomain.com:
| DNS field | Value |
|---|---|
| Type | CNAME |
| Name / Host | a |
| Target / Value | proxy.${new URL(SITE_URL).host} |
If settings also shows a TXT record, add it too: it proves you own the domain when the CNAME alone can't. You can delete it once the status is Active.
Propagation usually takes 1–10 minutes, and the certificate is issued as soon as DNS is right. Click Check status until the badge says Active.
3. Update your script tag
Load the script from your subdomain. It sends events next to wherever it was loaded from, so src is the only change:
<script
defer
data-website-id="YOUR_SITE_ID"
src="https://a.yourdomain.com/js/script.cookies.js"
></script>Settings shows the tag with your subdomain and settings filled in.
Verify
- Visit your live site (not the subdomain itself) and open the browser's Network tab.
- Check that the script loads from
a.yourdomain.com, and events go tohttps://a.yourdomain.com/api/e. - The visit shows up on the Realtime page.
Troubleshooting
The status stays pending
- Check that the CNAME matches the one in settings, and that it's a DNS record, not a URL redirect or forwarding rule.
- If your DNS provider has a proxy mode (Cloudflare's orange cloud), turn it off for this record.
- Wait a few minutes, then click Check status.
The status shows an error
- Re-check the record's type, name and value, and add the TXT record if settings shows one.
- Make sure you're editing the DNS zone of your root domain, such as
yourdomain.com.
Still blocked
- Avoid obvious subdomains such as
analytics,tracking,metricsordatasense. - Make sure the tag loads from
https://and your subdomain. - With a Content Security Policy, allow your subdomain in
script-srcandconnect-src.
Remove it
In Settings → Ad blockers → Managed Proxy, click the × next to the subdomain. Switch your script tag back to https://usedatasense.com/js/script.cookies.js first, then delete the DNS records.
Compare the options
| Managed proxy | Self-hosted proxy | |
|---|---|---|
| Best for | Most sites | Apps that already proxy requests through their own server |
| Code | None | A few rewrites |
| DNS | One CNAME | None |
| SSL | Automatic | Your host's |
| Script URL | Your subdomain | A path on your domain, such as /_ds/js/script.cookies.js |
| Maintenance | Handled by Datasense | Handled by your app or server |
For the self-hosted options, see the proxy guide.