Skip to content

Domain on your Cloudflare account

The zone kind (Domain on this Cloudflare account (recommended) in the add dialog) serves a tracking hostname from a domain that is a zone of the same Cloudflare account that runs your amabledata installation. Because the zone, its certificate and the tracking worker all live in the same account, you only need:

  • one proxied DNS record for the hostname;
  • one Workers route that sends the hostname to the tracking worker amable-edge.

No API token or extra configuration is needed on the installation. The in-app description reads: The domain is a zone of the account that runs the tracking worker: one DNS record and one worker route, no extra certificates.

You add the domain in Analytics settings › Domains (/t/<workspace>/analytics/settings?tab=domains) and do the rest in the Cloudflare dashboard of the same account. For the general concepts see the Tracking domains overview.

While the domain is not active, its row shows the sentence On the Cloudflare account of the tracking worker: add the domain as a zone, create the proxied CNAME record, then add the worker route to the tracking worker. and two lines, each with Copy name and Copy value:

Type Name Value
CNAME Your hostname, e.g. track.example.com The workspace tracking host shown in the row
ROUTE track.example.com/* amable-edge

The tracking host shown as the CNAME value is the installation’s tracking target: the TRACKING_CNAME_TARGET setting when it is set, otherwise the host of the edge worker’s public origin.

amabledata verifies a zone domain by requesting:

GET https://<hostname>/.well-known/amable-tracking

The tracking worker answers this path on every hostname, even before the domain is registered, with HTTP 200 and:

{ "service": "amable-edge" }

The check succeeds only when the answer is a 2xx response whose JSON has service equal to amable-edge. Redirects are not followed. The request times out after 8 seconds.

Probe result New status Error stored Text shown in the row
Correct answer Active none none
No answer at all (DNS failure, TLS failure, connection refused, timeout) Waiting for DNS hostname_unreachable The hostname does not answer yet: check that the zone is active and the record is proxied.
Any other answer (wrong status code, redirect, other content) Error not_tracking_worker (HTTP <code>) The hostname answers, but not from the tracking worker: check the worker route.

The raw error, including the HTTP code, is returned by the API in the domain’s error field.

The probe runs when you add the domain, when you click Check now, and from the cron every 5 minutes for domains still in Waiting for DNS (each one at most every 10 minutes) and for domains in Error (each one at most once an hour). After fixing an error, click Check now to see the result at once instead of waiting for the hourly re-check.

There is no Issuing certificate step for zone domains: the zone’s own certificate covers the hostname.

Put the domain on the same Cloudflare account

Section titled “Put the domain on the same Cloudflare account”
  1. Sign in to the Cloudflare dashboard with the account that runs your amabledata installation.
  2. If the domain is not there yet, add it as a site (zone) and switch its nameservers at your registrar to the ones Cloudflare gives you. See Connect domains to Cloudflare and Migrate a domain.
  3. Wait until the zone shows as Active in Cloudflare.
  1. Open Analytics settings › Domains, pick the site and click Add domain.
  2. Type the Hostname (a subdomain, e.g. track.example.com).
  3. Keep Domain on this Cloudflare account (recommended) selected and click Add.
  4. The domain appears as Waiting for DNS with the CNAME and ROUTE lines. If both already exist, it becomes Active immediately.
  1. In Cloudflare, open the zone, then DNS › Records, and click Add record.
  2. Type: CNAME.
  3. Name: the subdomain part of your hostname (for track.example.com, type track). Use Copy name in amabledata to copy the full hostname.
  4. Target: the value shown on the CNAME line (use Copy value).
  5. Proxy status: Proxied (orange cloud). This is required: the Workers route only applies to proxied traffic, and the certificate comes from the proxy.
  6. Save.
  1. In the same zone, open Workers Routes and click Add route.
  2. Route: track.example.com/* (your hostname followed by /*, as on the ROUTE line).
  3. Worker: amable-edge.
  4. Save.
  1. Optionally test from a terminal:

    Terminal window
    curl -i https://track.example.com/.well-known/amable-tracking

    You should get HTTP/2 200 and {"service":"amable-edge"}.

  2. In amabledata, click Check now, or wait for the automatic check (within about 10 minutes).

  3. The status becomes Active and the toast The domain is active. appears.

Item Value
Kind zone
Required installation settings None
DNS record CNAME, name = hostname, target = tracking host shown, Proxied
Workers route <hostname>/* → amable-edge
Verification URL https://<hostname>/.well-known/amable-tracking
Expected answer 2xx, JSON { "service": "amable-edge" }
Probe timeout 8 seconds
Redirects Not followed (a redirect counts as a wrong answer)
Possible statuses Waiting for DNS, Active, Error

In development installations (ENVIRONMENT=dev) the probe always succeeds immediately.

  • Adding, checking and deleting need analytics:configure (owner, admin, marketer).
  • The domain must be a zone of the same Cloudflare account as the tracking worker: a Workers route can only point to a worker of the zone’s own account.
  • One hostname per site and workspace; see the hostname rules in the overview.
Symptom Cause Fix
The hostname does not answer yet: check that the zone is active and the record is proxied. (status Waiting for DNS) The DNS record is missing or not propagated; the zone is still pending nameservers; the record is DNS only so there is no edge certificate; the request timed out. Create the record, set it to Proxied, wait for the zone to be active, then Check now.
The hostname answers, but not from the tracking worker: check the worker route. with not_tracking_worker (HTTP 404), (HTTP 522) or similar The Workers route is missing, has a typo, or points to another worker, so the request reaches the record’s target instead of the tracking worker. Add or fix the route <hostname>/* → amable-edge, then Check now.
Same message with (HTTP 301) or (HTTP 302) A redirect rule, page rule or access policy on the zone redirects the request. Exclude the tracking hostname from redirects and access policies.
Same message with (HTTP 403) A firewall or access rule blocks the request. Allow the tracking hostname, at least the path /.well-known/amable-tracking.
Same message with (HTTP 200) Something else answers with a page that is not the marker JSON (for example a different worker on a broader route). Make sure the most specific route for the hostname points to amable-edge.
Still Error after fixing Domains in Error are re-checked automatically only once an hour. Click Check now, or wait up to about an hour.
The zone is on another Cloudflare account Routes cannot cross accounts. Move the zone to the installation’s account, or use a CNAME domain.