> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lettr.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Tracking

> Measure engagement with Lettr open and click tracking, enabled by default, and disable either per email for privacy-sensitive messages

Tracking tells you what happens after an email is delivered. Open tracking records when a recipient views your message, and click tracking records when they interact with links inside it. Together, these signals help you measure engagement, identify content that resonates, and trigger follow-up workflows based on recipient behavior. Lettr enables both by default, but you can disable either on a per-email basis for privacy-sensitive messages.

## Default Tracking

By default, Lettr tracks opens and clicks for all emails. No additional configuration is needed — tracking is active as long as you send HTML content:

```javascript theme={null}
await lettr.emails.send({
  from: 'you@example.com',
  to: ['recipient@example.com'],
  subject: 'Newsletter',
  html: '<p>Check out our <a href="https://example.com">website</a>!</p>'
  // Open and click tracking enabled by default
});
```

## Customize Tracking Options

You can override the default tracking behavior on a per-email basis using the `options` object. This is useful for privacy-sensitive emails like password resets or data exports where tracking would be inappropriate:

```javascript theme={null}
await lettr.emails.send({
  from: 'you@example.com',
  to: ['recipient@example.com'],
  subject: 'Private Message',
  html: '<p>This is a private message.</p>',
  options: {
    open_tracking: false,
    click_tracking: false
  }
});
```

## How Open Tracking Works

Lettr inserts a tiny invisible image (tracking pixel) into your HTML emails. When the recipient's email client loads images, the open is recorded.

<Note>
  Open tracking requires HTML content. Plain text emails cannot be tracked for opens. Some email clients block images by default, which may result in under-reported open rates.
</Note>

## How Click Tracking Works

Lettr rewrites links in your email to route through our tracking servers. When a recipient clicks a link:

1. The click is recorded with timestamp and link URL
2. The recipient is immediately redirected to the original destination

```html theme={null}
<!-- Original link in your email -->
<a href="https://example.com/product">View Product</a>

<!-- Becomes (with click tracking enabled) -->
<a href="https://track.lettr.com/c/abc123">View Product</a>
```

## Custom Tracking Domain

By default, tracking links use Lettr's domain (e.g., `track.lettr.com`). Configuring a custom tracking domain (e.g., `track.yourdomain.com`) improves deliverability because links match your sending domain, and it builds trust with recipients who see a familiar domain in link previews:

```javascript theme={null}
await lettr.emails.send({
  from: 'you@example.com',
  to: ['recipient@example.com'],
  subject: 'Newsletter',
  html: '<p>Click <a href="https://example.com">here</a>!</p>',
  options: {
    click_tracking: true
  }
});
```

Links will use your configured tracking domain (e.g., `track.yourdomain.com`) if set up in your domain settings.

<Card title="Set Up Tracking Domain" icon="globe" href="/learn/domains/tracking-domains">
  Learn how to configure a custom tracking domain
</Card>

## Transactional Flag

The `transactional` option signals to Lettr how to handle the email for deliverability purposes. Transactional emails (triggered by a user action) are typically sent with higher priority and are less likely to be filtered by receiving mail servers:

```javascript theme={null}
await lettr.emails.send({
  from: 'you@example.com',
  to: ['recipient@example.com'],
  subject: 'Password Reset',
  html: '<p>Click here to reset your password...</p>',
  options: {
    transactional: true  // Default is true
  }
});
```

<Tip>
  Transactional emails (password resets, order confirmations) typically have higher deliverability than marketing emails.
</Tip>

## Tracking Options Reference

| Option           | Type    | Default | Description                  |
| ---------------- | ------- | ------- | ---------------------------- |
| `open_tracking`  | boolean | `true`  | Track when emails are opened |
| `click_tracking` | boolean | `true`  | Track when links are clicked |
| `transactional`  | boolean | `true`  | Mark as transactional email  |

## Privacy Considerations

Some emails should not be tracked. Data exports, security notifications, and emails sent in jurisdictions with strict privacy laws (such as GDPR) may require tracking to be disabled. Disable both open and click tracking for these messages:

```javascript theme={null}
// For privacy-sensitive emails
await lettr.emails.send({
  from: 'you@example.com',
  to: ['privacy-conscious@example.com'],
  subject: 'Your Data Export',
  html: '<p>Here is your requested data export.</p>',
  options: {
    open_tracking: false,
    click_tracking: false
  }
});
```

## Viewing Tracking Data

Tracking data is delivered in real time through [webhooks](/learn/webhooks/introduction). Set up webhook handlers for `engagament.open` and `engagament.click` events to capture engagement data as it happens:

```javascript theme={null}
app.post('/webhooks/lettr', (req, res) => {
  const event = req.body;

  if (event.type === 'engagament.open') {
    console.log('Email opened:', event.data.request_id);
  }

  if (event.type === 'engagament.click') {
    console.log('Link clicked:', event.data.target_link_url);
  }

  res.sendStatus(200);
});
```

You can also view aggregate tracking data in the [Analytics dashboard](/learn/analytics/introduction).

<Card title="Analytics" icon="chart-line" href="/learn/analytics/introduction">
  Learn more about viewing and analyzing tracking data
</Card>
