Key takeaways
- Open the domain in Mailgun and find the tracking records under Domain Verification & DNS.
- Create the CNAME at the exact hostname shown, with the target mailgun.org.
- Confirm the CNAME with dig, then verify the domain in Mailgun.
To set up a custom tracking domain for Mailgun, add the tracking CNAME record shown in your domain's Domain Verification & DNS section, which points your tracking hostname to `mailgun.org`. Mailgun uses that CNAME to rewrite links and track opens, so without it click and open tracking will not work as intended. Then switch on tracking in your domain's settings and send a test.
Research checked: 12 November 2026
This guide covers the setup path. Choosing whether tracking suits cold email and fixing a broken tracking link are in the other two guides.
The short answer
- Open the domain in Mailgun and find the tracking records under Domain Verification & DNS.
- Create the CNAME at the exact hostname shown, with the target `mailgun.org`.
- Confirm the CNAME with `dig`, then verify the domain in Mailgun.
- Turn on open and click tracking in Tracking Settings on the domain page, and send a test with a link.
Setup steps
Step 1: Find the record
Mailgun's tracking documentation states that you need to point CNAME records to `mailgun.org` so Mailgun can rewrite links and track opens. The record itself appears under the Tracking records section of the domain's DNS records. Use the hostname shown there rather than typing one from memory, because the hostname is tied to your domain's configuration.
Step 2: Create the CNAME
A CNAME record maps a name to another name. For a tracking hostname such as `email.example.com`, the record looks like this in most DNS hosts:
``` email.example.com. CNAME mailgun.org. ```
Enter only the left-hand part of the name if your host appends the domain automatically. A CNAME cannot sit at a name that already holds other records, so check that `email.example.com` is free before you add it. Pick a hostname that is clearly for tracking, so that a future reader of your DNS zone understands why it exists. Record the hostname and the date in your change log, because deleting it later will break links in mail already in recipients' inboxes.
Step 3: Verify the record
``` dig +short CNAME email.example.com ```
The answer should be `mailgun.org.`. If it is empty, the record is missing or not yet propagated. Mailgun's verification guide states that DNS changes can take 24 to 48 hours, and that you can click Verify DNS settings in the Domain Settings section once the record resolves.
Step 4: Turn on tracking and test
Open Tracking Settings on the domain page and enable the tracking options you need, such as opens and clicks. Mailgun's open-tracking documentation also lets you set the tracking flag per message, which overrides the domain setting. Open tracking uses a small transparent image, so a message needs an HTML part to register opens. Plain-text-only messages do not track opens.
Send a test with an HTML body and a link. Click the link, then check the event in Mailgun's logs. A tracked link should route through your tracking hostname rather than the original destination. Check the rewritten URL in the message source to confirm the hostname is yours. Then repeat the test from a second mail client, because some clients block remote images, so opens will look lower than they are.
HTTPS tracking
By default tracking uses HTTP. The tracking documentation says you can switch to HTTPS in the domain settings, and Mailgun then generates a Let's Encrypt certificate for the tracking domain. The certificate depends on the CNAME resolving correctly, so do not switch to HTTPS until the CNAME test passes.