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

# Engagement metrics

> Learn how to track email opens and link clicks across your campaigns.

## What engagement metrics measure

Engagement metrics report how recipients interact with your mail. They cover two tracked actions:

* `open`: the number of times the email was opened.
* `click`: the number of clicks on tracked links in HTML messages.

Each event count is paired with the number of recipients who could have performed the action, so you can compute open and click rates:

* `open_tracking_delivered`: the number of recipients of delivered HTML messages where open tracking was enabled in the
  send request.
* `click_tracking_delivered`: the number of recipients of delivered HTML messages containing tracked links, where click
  tracking was enabled in the send request.

Messages sent without the corresponding tracking enabled do not contribute to either count.

Use these metrics to measure campaign reach, identify content that resonates, and compare engagement across
send times or audience segments.

## Example query

The example below requests daily engagement totals for a single campaign in January 2026.

<CodeGroup>
  ```bash cURL theme={null}
  #!/usr/bin/env bash
  # Retrieve daily open and click counts for a single campaign.
    set -u
    : "${MAILCHANNELS_API_KEY:?Set MAILCHANNELS_API_KEY before running}"

  curl -G "https://api.mailchannels.net/tx/v1/metrics/engagement" \
    -H "X-Api-Key: $MAILCHANNELS_API_KEY" \
    --data-urlencode "start_time=2026-01-01T00:00:00Z" \
    --data-urlencode "end_time=2026-01-31T23:59:59Z" \
    --data-urlencode "campaign_id=newsletter_jan_2026" \
    --data-urlencode "interval=day"
  ```

  ```javascript Node.js theme={null}
  import { MailChannels } from "mailchannels-sdk";

  const { MAILCHANNELS_API_KEY } = process.env;
  if (!MAILCHANNELS_API_KEY) throw new Error("Set MAILCHANNELS_API_KEY before running");

  const mailchannels = new MailChannels(MAILCHANNELS_API_KEY);

  const { data, error } = await mailchannels.metrics.engagement({
    startTime: "2026-01-01T00:00:00Z",
    endTime: "2026-01-31T23:59:59Z",
  });

  if (error) {
    console.error("Get engagement metrics failed:", error);
    process.exit(1);
  }
  console.log(data);
  ```

  ```python Python theme={null}
  import os
  import sys

  import mailchannels

  if not os.environ.get("MAILCHANNELS_API_KEY"):
      sys.exit("Set MAILCHANNELS_API_KEY before running")

  # Retrieve daily open and click counts for a single campaign.
  response = mailchannels.Metrics.engagement(
      start_time="2026-01-01T00:00:00Z",
      end_time="2026-01-31T23:59:59Z",
      campaign_id="newsletter_jan_2026",
      interval="day",
  )

  print(response)
  ```

  ```php PHP theme={null}
  <?php

  require_once __DIR__ . '/vendor/autoload.php';

  use MailChannels\Client;

  $api_key = getenv('MAILCHANNELS_API_KEY') or exit("Error: MAILCHANNELS_API_KEY is not set\n");

  $client = new Client(apiKey: $api_key);

  // Retrieve daily open and click counts for a single campaign.
  $response = $client->metrics->engagement(
      startTime:  '2026-01-01T00:00:00Z',
      endTime:    '2026-01-31T23:59:59Z',
      campaignId: 'newsletter_jan_2026',
      interval:   'day',
  );

  print_r($response->toArray());
  ```
</CodeGroup>

<Info>
  Open and click tracking is not available in our free tier.
</Info>
