Removing your subdomain later?
First switch your pages back to a snippet that loads the tag from betterstack.net. Pages that load it from your subdomain stop collecting data once the subdomain or its CNAME record is removed.
Load the JavaScript tag and send its data through a subdomain you own, like t.example.com, instead of Better Stack's hosts. Use it when your pages may only talk to your own domain, and to keep the tag working for visitors with ad blockers.
t.example.com. Avoid words ad blockers look for, such as analytics, tracking or telemetry.At your DNS provider, add a CNAME record for your subdomain:
| Type | Name | Target |
|---|---|---|
| CNAME | t |
proxy.betterstack.net |
In Cloudflare, set the record to DNS only, so Cloudflare doesn't proxy it.
Better Stack checks the record, usually in under a minute. Once it's right, the Subdomain field shows a green check with the tooltip CNAME configured correctly.
The tag now sends errors, session replays, web events and console logs through your subdomain.
First switch your pages back to a snippet that loads the tag from betterstack.net. Pages that load it from your subdomain stop collecting data once the subdomain or its CNAME record is removed.
Already run a reverse proxy on your domain, like a Cloudflare Worker or nginx? Point the tag at it instead of adding the CNAME record, and leave Subdomain in Better Stack empty. Your proxy needs to:
/b.js to https://betterstack.net/b.js, keeping the query string.https://t.example.com/s123.eu-nbg-2.betterstackdata.com/web/123 goes to https://s123.eu-nbg-2.betterstackdata.com/web/123. Only forward to betterstack.net and *.betterstackdata.com.X-Forwarded-For. Otherwise, Better Stack shows your proxy's address and location instead of the visitor's.Then load the tag from your proxy, and set proxyHost before init:
Some environments, like a Twitch extension, only run scripts bundled with your app.
Download the tag:
Load betterstack.js in your build in place of the snippet.
After it runs, start the tag through your subdomain or reverse proxy:
The copy keeps the settings it was downloaded with, so download it again after you change them in Better Stack.
We use cookies to authenticate users, improve the product user experience, and for personalized ads. Learn more.