Tracking domains overview
Overview
Section titled “Overview”A tracking domain is a hostname you own, such as track.example.com, that serves the tracking
links of one analytics site instead of the shared edge host. Ad clicks then go through your own
brand, and the visitor cookie set by the links is first-party on your domain.
Tracking domains are managed per site in Analytics settings, tab Domains
(/t/<workspace>/analytics/settings?tab=domains). Pick the site in the site picker first.
The in-app hint reads: Serve tracking links and the tracker from your own hostname (e.g. track.example.com): first-party cookies, links that match your brand.
What changes with a tracking domain
Section titled “What changes with a tracking domain”Without a tracking domain, links live on the shared edge host with the site in the path:
https://<edge host>/s/<siteId>/go/.... On an active tracking domain the same routes answer
without the prefix:
| Route | Purpose |
|---|---|
https://track.example.com/go/... |
Entrance (tracking link of a funnel and traffic source) |
https://track.example.com/a/<n> |
Action link on a funnel page |
https://track.example.com/pb and /pb/event |
Conversion postbacks |
https://track.example.com/s.js (also /s.cookieless.js, /s.hash.js) and /e |
The web analytics tracker and the endpoint it sends to: the tracker sends its events to /e on the origin it was loaded from. |
The snippet shown in the app uses the shared edge host: to load the tracker from your domain, replace
the host of its src once the domain is Active (see
Install the tracker).
Links on a tracking domain use a visitor cookie at the root of the domain; the shared host keeps one cookie path per site. See Tracking links and Tracking endpoints.
How it works
Section titled “How it works”Two kinds of domain
Section titled “Two kinds of domain”When you add a domain you choose how the hostname reaches the tracking worker (the edge worker of
your installation, named amable-edge):
| Kind (dialog label) | When to use | What you set up | Certificate |
|---|---|---|---|
Domain on this Cloudflare account (recommended) (zone) |
The domain is (or can be) a zone of the same Cloudflare account that runs your installation. | One proxied DNS record and one Workers route. | The zone’s own certificate. |
DNS stays elsewhere (CNAME) (cname) |
The domain’s DNS is managed elsewhere and cannot move. | One CNAME record (plus a TXT record when asked). | Issued automatically through Cloudflare for SaaS custom hostnames. |
The zone kind needs no configuration on the installation. The cname kind needs three settings
on the core worker (CF_ZONE_ID, CF_API_TOKEN, TRACKING_CNAME_TARGET); without them the option
is disabled in the dialog with the text Not configured on this installation: the domain must be a
zone of this Cloudflare account.
Details: Domain on your Cloudflare account and Domain with DNS elsewhere (CNAME).
Statuses
Section titled “Statuses”| Status pill | Value | Meaning |
|---|---|---|
| Waiting for DNS | pending_dns |
The hostname does not reach the tracking worker yet (zone kind), or Cloudflare has not verified the hostname yet (CNAME kind). |
| Issuing certificate | pending_ssl |
CNAME kind only: the hostname is verified and Cloudflare is issuing the certificate. |
| Active | active |
The domain works. Links on it are served. |
| Error | error |
The configuration is wrong (for example the hostname answers but not from the tracking worker), or the certificate service reported a failure. The error text is shown under the domain. |
Only Active hostnames are served. A request to a hostname in any other status is answered as an unknown host.
A newly added domain starts as Waiting for DNS. A zone domain is checked immediately when you
add it, so it can become Active right away if the record and route already exist.
Checks
Section titled “Checks”A check refreshes the status of a domain:
- Zone domains are checked by requesting
https://<hostname>/.well-known/amable-tracking. The tracking worker answers this path on every hostname with the JSON{ "service": "amable-edge" }. One good answer proves DNS, proxy, certificate and route at once. - CNAME domains are checked by asking Cloudflare for the state of the custom hostname.
Checks happen in three ways:
- When you add the domain (zone kind).
- When you click Check now.
- Automatically, from the core worker’s cron, which runs every 5 minutes. At each run it re-checks the domains in Waiting for DNS or Issuing certificate whose last check is at least 10 minutes old, and the domains in Error whose last check is at least 1 hour old, least recently checked first, at most 5 per run. You do not need to press Check now for a pending domain to become active.
Domains in Error usually wait for a fix on your side (DNS, Workers route, Cloudflare), so they
are re-checked only once an hour: after fixing the cause, click Check now to see the result at
once, or let the cron bring the domain back to Active within about an hour. Domains in
Error because their site was deleted (site_deleted) are not re-checked: the cron only retries
their removal.
After activation
Section titled “After activation”The tracking worker looks up hostnames through the core and caches the answer for up to 5 minutes (an unknown hostname for up to 1 minute) in each worker instance. A domain that just became Active can therefore take up to about a minute to answer everywhere, and a deleted domain can keep answering for up to about 5 minutes.
Hostname rules
Section titled “Hostname rules”- A valid DNS hostname: lowercase letters, digits and hyphens in labels of 1 to 63 characters, a
top-level domain of at least 2 letters, 253 characters at most.
https://and any path you paste are removed. - Use a subdomain you control, not the main site: the dialog says Use a subdomain you control, not the main site. You will then create a DNS record at your DNS provider.
- One hostname belongs to one site of one workspace, and it cannot be a hostname already connected elsewhere in the installation (including domains connected for other features).
- Reserved names are refused:
localhost,local,internal,invalid,example,arpa,workers.dev,pages.dev,cloudflare.com,cloudflare.net,cloudflare-dns.comand any of their subdomains, plus the hostnames of the installation itself (dashboard, edge host, CNAME target) and their subdomains.
Step by step
Section titled “Step by step”Add a tracking domain
Section titled “Add a tracking domain”- Open Analytics settings › Domains and pick the site.
- Click Add domain. The dialog Add a tracking domain opens.
- Type the Hostname, for example
track.example.com. - Choose the kind: Domain on this Cloudflare account (recommended) or DNS stays elsewhere (CNAME).
- Click Add. The toast Domain added: now create the DNS records. appears and the domain is listed with the records to create.
- Follow the instructions of the kind you chose: zone or CNAME.
Check a domain now
Section titled “Check a domain now”Click Check now on the domain. When it is active, the toast The domain is active. appears;
otherwise the toast shows the current status (for example Waiting for DNS). The line
Last check: <when> updates.
Delete a domain
Section titled “Delete a domain”- Click the trash icon (Delete domain) on the domain.
- The dialog Delete
<hostname>? warns: Links and snippets using this hostname stop working. You can remove the DNS records afterwards. - Confirm with Delete domain. The toast Domain deleted. appears.
For a CNAME domain the custom hostname is also removed from Cloudflare. Remove your own DNS record and Workers route afterwards.
Reference
Section titled “Reference”Domains tab
Section titled “Domains tab”| Element | Description |
|---|---|
| Add domain | Opens the add dialog. Only with the configuration permission. |
| Empty state | No tracking domains yet. |
| Domain row | Hostname, status pill, Last check: <when> (or never). |
| Check now | Runs a check. Only with the configuration permission. |
| Delete domain | Trash icon. Only with the configuration permission. |
| Error box | The last error in red (see the kind pages for each text). |
| Records box | Shown while the domain is not active: the records to create, each with Copy name and Copy value. |
Under /api/v2/t/<workspace>/analytics:
| Method and path | Permission | Purpose |
|---|---|---|
GET /tracking-domains?site_id=<site> |
analytics:read |
Domains of the site, plus options.cname_available and options.target (the CNAME target). |
POST /tracking-domains |
analytics:configure |
Body { "site_id", "hostname", "kind": "zone" | "cname" }. kind defaults to cname in the API (the dashboard defaults to zone). Answers 201. |
GET /tracking-domains/{id} |
analytics:read |
One domain. |
POST /tracking-domains/{id}/check |
analytics:configure |
Runs a check and returns the domain. |
DELETE /tracking-domains/{id} |
analytics:configure |
Disconnects the domain. |
A domain object carries id, site_id, hostname, kind, status, dns (cname_name,
cname_target, txt_name, txt_value), error, created_at and checked_at. Adding and
deleting write the audit events analytics.tracking_domain_created and
analytics.tracking_domain_deleted.
Timing
Section titled “Timing”| Item | Value |
|---|---|
| Cron frequency | Every 5 minutes |
| Minimum time between automatic checks of a domain | 10 minutes (pending domains), 1 hour (domains in Error) |
| Checks per cron run | 5 at most |
| Zone check timeout | 8 seconds |
| Hostname lookup cache (tracking worker) | 5 minutes (found), 1 minute (not found) |
Limits and permissions
Section titled “Limits and permissions”| Action | Permission | Roles by default |
|---|---|---|
| See domains and statuses | analytics:read |
Owner, admin, marketer, analyst, viewer |
| Add, check, delete | analytics:configure |
Owner, admin, marketer |
When a site is deleted its tracking domains are disconnected too. If Cloudflare cannot be reached
at that moment, the domain stays as Error with site_deleted (no longer served) and the cron
retries the removal.
Troubleshooting
Section titled “Troubleshooting”| Symptom or message | Cause | Fix |
|---|---|---|
| Enter a valid hostname you own (platform hostnames are not allowed). | The hostname is malformed or reserved. | Use a subdomain of a domain you own. |
| This hostname is already connected. | Another site or workspace, or another feature, already uses the hostname. | Delete it there first, or pick another subdomain. |
| Custom tracking domains are not configured on this installation. | You tried to add or check a CNAME domain without the Cloudflare settings. | Use the zone kind, or configure the settings (CNAME domains). |
| The certificate service did not answer. Try again in a moment. | The Cloudflare API failed or refused the request. | Retry; check the token and zone settings. |
| Stays on Waiting for DNS | DNS not created or not propagated yet. | See the kind pages; the cron keeps checking. |
| Stays on Error | The cause is not fixed yet, or the hourly automatic re-check has not run since you fixed it. | Fix the cause, then Check now (or wait up to about an hour). |
| Active but links answer “unknown host” for a minute | Lookup cache of the tracking worker. | Wait up to a minute. |

