# Set up a custom tracking domain

> Publish the tracking CNAME for your sending domain, verify it, and turn on open and click tracking so links and pixels use your own hostname over HTTPS.

Open and click tracking in Emailit always runs on a hostname on your own domain, such as `go.acme.com`. This guide shows how to publish the CNAME record for that hostname, verify it and turn tracking on.

## Before you begin

- Add and verify the sending domain. See [Add a domain](/docs/domains/add-a-domain/).
- Make sure you can edit the domain's DNS records.
- Pick a hostname that isn't used for anything else. The default is `go`, which gives `go.acme.com`.

## Choose the tracking subdomain

The tracking hostname is `<tracking subdomain>.<sending domain>`. To use something other than `go`:

**Dashboard**

  On the domain page in **Email API → Domains**, find the **Custom Subdomains** card. Enter a prefix in **Tracking Subdomain**, for example `links`, and select **Save**.

**API**

  Call [Update a domain](/docs/api-reference/domains/update/) with `tracking_key`. You can also pass it when you [create the domain](/docs/api-reference/domains/create/).

```bash
curl https://api.emailit.com/v2/domains/acme.com \
  -X POST \
  -H "Authorization: Bearer $EMAILIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "tracking_key": "links" }'
```

The prefix can contain lowercase letters, digits and hyphens, up to 63 characters, and must start and end with a letter or digit. Changing it resets the tracking record to **Not checked**, so publish a CNAME for the new hostname and check DNS again.

## Publish and verify the CNAME

1. **Add the CNAME record.** At your DNS provider, create this record:

   | Type | Host | Target |
   | --- | --- | --- |
   | CNAME | `go` (or your tracking subdomain) | `go.emailitmail.com` |

   For `acme.com`, the result is:

```txt
go.acme.com.   CNAME   go.emailitmail.com.
```

   If you send from a subdomain such as `mail.acme.com`, the host is `go.mail` in the `acme.com` zone.

2. **Turn off proxying on Cloudflare.** If your DNS is on Cloudflare, set the record's proxy status to **DNS only** (grey cloud). A proxied record returns Cloudflare's IP addresses instead of the CNAME, and tracking can't verify or serve requests. [Cloudflare setup](/docs/domains/cloudflare/) creates the record as DNS only for you.

3. **Check DNS.** On the domain page, select **Check DNS**. The status badge in the **Tracking** card changes to **OK** when the CNAME points to `go.emailitmail.com`.

4. **Turn tracking on.** In the **Tracking** card, turn on **Track loads**, **Track clicks** or both. The switches stay disabled until the CNAME shows **OK**.

   With the API, call [Update a domain](/docs/api-reference/domains/update/) with `"track_loads": true` and `"track_clicks": true`.

These switches set the default for mail from the domain. You can override them for a single email with the `tracking` field when you send through the API. See [Open and click tracking](/docs/tracking/#turn-tracking-on).

## HTTPS

All tracking links and pixels use `https://`. Emailit issues and renews the certificate for your tracking hostname automatically, the first time it receives a request for it. You don't need to upload a certificate or change anything else.

## Verify it worked

1. **Send a test email** from the domain with at least one link, for example with **Compose** on the **Emails** page.

2. **Check the links.** In the received message, hover over a link. It should start with `https://go.acme.com/`, not your original URL.

3. **Open and click.** Open the email and click the link. The email's page in **Email API → Emails** lists the open under **Loads** and the click under **Clicks**, and the status changes to `loaded` and then `clicked`.

## Troubleshooting

| Symptom | Fix |
| --- | --- |
| Tracking shows **Missing** | The CNAME isn't published at the expected host. Check with `dig +short CNAME go.acme.com @1.1.1.1`. A common cause is entering the full name where the provider expects only `go`. |
| Tracking shows **Invalid** | The CNAME points somewhere else, or the record is proxied on Cloudflare. Point it to `go.emailitmail.com` and set it to **DNS only**. |
| **Track loads** and **Track clicks** are greyed out | The CNAME isn't verified yet. Select **Check DNS** after publishing it. |
| Emails arrive with the original links | Tracking is off for the domain, the message was sent with `"tracking": false`, or the tracking record wasn't **OK** at the last DNS check. Emailit sends untracked rather than failing. |
| Links show a certificate warning | The CNAME was created moments ago. Wait a minute and try again. If it persists, check that the record isn't proxied. |
| A CNAME already exists at `go` | Choose another tracking subdomain, such as `links` or `t`, and publish the CNAME there. |

## Related

  - [Open and click tracking](/docs/tracking/): How tracking works and how accurate it is.
  - [DNS records](/docs/domains/dns-records/): Every record for a sending domain.

---
Source: https://emailit.com/docs/tracking/custom-tracking-domain/
