# Tracking and unsubscribes

> Track opens and clicks on sent mail, and add one-click unsubscribe to bulk mail.

URL: https://docs.workwae.com/guides/tracking

Track whether recipients open a message and click its links, and give bulk mail a working unsubscribe. Both are options on a [send](/guides/sending) or [mail merge](/guides/mail-merge).

## Open and click tracking

With tracking on, the HTML part gets a 1x1 pixel (opens) and its links go through a Workwae redirect (clicks). Text parts are never changed.

The account's `trackOpens`, `trackClicks` and `trackingHoneypot` settings are the defaults. A send's own `tracking` object overrides them.

```bash tab="cURL"
curl -X POST "https://api.workwae.com/v1/accounts/$ACCOUNT_ID/outbox" \
  -H "Authorization: Bearer $WORKWAE_API_KEY" \
  -H "content-type: application/json" \
  -d '{
  "to": [{ "address": "ada@example.com" }],
  "subject": "Spring sale",
  "html": "<p>Our <a href=\"https://shop.example.com/sale\">spring sale</a> starts today.</p>",
  "tracking": { "opens": true, "clicks": true, "honeypot": true }
}'
```

```ts tab="TypeScript"
const queued = await workwae.outbox.create({
  accountId,
  to: [{ address: "ada@example.com" }],
  subject: "Spring sale",
  html: '<p>Our <a href="https://shop.example.com/sale">spring sale</a> starts today.</p>',
  tracking: { opens: true, clicks: true, honeypot: true },
});
```

- Tracking is per message, not per recipient: every recipient of one send gets the same MIME. Use a [mail merge](/guides/mail-merge) for per-recipient numbers.
- [Drafts](/guides/drafts#behavior) on Gmail or Microsoft 365 cannot be tracked (`tracking_unsupported`).

## Read the results

The outbox entry holds counts; `GET /v1/accounts/{accountId}/outbox/{outboxId}/tracking` lists each hit with what its request showed. Hits are also reported as `message.opened` and `message.clicked` [events](/guides/events/mail).

```bash tab="cURL"
curl "https://api.workwae.com/v1/accounts/$ACCOUNT_ID/outbox/$OUTBOX_ID/tracking" \
  -H "Authorization: Bearer $WORKWAE_API_KEY"
```

```ts tab="TypeScript"
const entry = await workwae.outbox.get({ accountId, outboxId });
console.log(entry.humanOpenCount, entry.machineOpenCount, entry.humanClickCount);

const hits = await workwae.outbox.tracking({ accountId, outboxId });
```

Each hit is classified:

| Class | Meaning |
| --- | --- |
| `human` | A person opened or clicked. |
| `proxy` | A machine, such as Gmail's image proxy. |
| `prefetch` | A machine, such as Apple Mail Privacy Protection. |
| `scanner` | A machine, such as a link scanner. |
| `unknown` | Not classifiable. |

## Honeypot link

`honeypot: true` adds one hidden link that only machines follow, which sharpens the `scanner` classification. It needs click tracking (`honeypot_needs_click_tracking` otherwise).

## Unsubscribe links

Name a [suppression list](/guides/suppressions) with `listId` to send bulk mail properly:

- The message gets one-click unsubscribe headers (RFC 8058).
- `{{rcpt.unsubscribeUrl}}` in a [template](/guides/templates#variables) renders the recipient's own unsubscribe link.
- An address on that list or on the global list is skipped with reason `suppressed`.
- A single send naming a list must have exactly one `to` and no `cc` or `bcc`. For many recipients, use a [mail merge](/guides/mail-merge).

Unsubscribing through the header or the link always suppresses the address, regardless of the `optOutHandling` setting; see [Detected opt-outs](/guides/suppressions#opt-outs).

## Your own tracking domain

By default, tracking pixels, click links and unsubscribe links point at Workwae's tracking host. A workspace can serve them from a domain of its own, such as `go.example.com`, so recipients and their mail filters see your name in the links and your reputation is not shared with other senders. It needs an admin or owner, a plan with the tracking module (`403 plan_module_unavailable` without it), and a deployment with custom tracking domains enabled (without one, every route answers `400 tracking_domain_unavailable`).

1. Set the hostname. It must be a subdomain you control (`go.example.com`, not `example.com`) that no workspace uses, as either a tracking or a [connect domain](/guides/oauth-apps#connect-domain) (`409 tracking_domain_taken`).
2. Publish the records in the answer at your DNS provider. The `CNAME` in `records` is what points the domain at Workwae. The `TXT` record in `ownership` (`_workwae-challenge.go.example.com`) is required: it proves you control the domain's DNS, and the domain does not turn active without it, whatever the CNAME does. Any other `TXT` records in `records` are optional: they let the hostname and its certificate validate before the CNAME is in place, and can be removed once the domain is active.
3. Wait for `status: "active"`. Workwae checks every few minutes, or call `refresh` to check now. The certificate is issued and renewed for you.

```bash tab="cURL"
curl -X PUT "https://api.workwae.com/v1/settings/tracking-domain" \
  -H "Authorization: Bearer $WORKWAE_API_KEY" \
  -H "content-type: application/json" \
  -d '{ "hostname": "go.example.com" }'
```

```ts tab="TypeScript"
const domain = await workwae.trackingDomain.set({ hostname: "go.example.com" });
console.log(domain.status, domain.records);

// Later: check now instead of waiting for the next check.
const checked = await workwae.trackingDomain.refresh();
```

```json title="Pending until the CNAME and the certificate are in place"
{
  "hostname": "go.example.com",
  "status": "pending",
  "records": [
    { "type": "CNAME", "name": "go.example.com", "value": "edge.example.net" },
    { "type": "TXT", "name": "_cf-custom-hostname.go.example.com", "value": "0e2d5a7f-1548-4f27-8c05-b577cb14f4ec" }
  ],
  "error": "custom hostname does not CNAME to this zone.",
  "activatedAt": null,
  "createdAt": "2026-10-29T18:11:23.531Z"
}
```

| Status | Meaning |
| --- | --- |
| `pending` | Waiting for the DNS records (the ownership `TXT` included) and the certificate. `error` says what is still missing. A domain pending for 7 days fails. |
| `active` | Serving. |
| `failed` | The edge gave up, or the records were never published. `error` says why. Set the domain again to start over. |

- **What uses it.** Once `active`, new tracked sends use `https://{hostname}` for the pixel, the click links, the `List-Unsubscribe` header and `{{rcpt.unsubscribeUrl}}`. While `pending` or `failed`, and without a domain, they use Workwae's tracking host. The address is read when a send is queued (the body's unsubscribe link) and when it is delivered (pixel, links and header), so a domain that turns active applies to the next message. A list send needs an https tracking address, which an active domain is.
- **Mail already sent keeps the host it went out with.** Removing or replacing the domain stops its links working: recipients who click one get an error page. Replace a domain only when its old mail no longer matters.
- **What it serves.** The domain answers only the tracking paths (`/t/o`, `/t/c`, `/t/u`, and a bare `/`), and only for tokens of your workspace. A token of another workspace gets the answer of an invalid one. Everything else is a plain 404.
- **Removing it.** `DELETE /v1/settings/tracking-domain` deletes the hostname at the edge and the setting. Deleting the workspace deletes it too.

See the [settings reference](/reference/settings) for the routes. The console manages the domain under Settings, Tracking domain.
