Skip to main content
Track how recipients engage with your emails using Ark’s built-in open and click tracking. This guide covers setup, configuration, and best practices.

How Tracking Works

Open Tracking

Ark inserts a tiny transparent image (tracking pixel) into your HTML emails. When the image loads, we record an open event.

Click Tracking

Links in your emails are rewritten to pass through Ark’s tracking server. When a recipient clicks, we record the event and redirect them to the original URL.

Enabling Tracking

Tracking is enabled by default. You can control it per-email:
from ark import Ark

client = Ark()

email = client.emails.send(
    from_="hello@yourdomain.com",
    to=["user@example.com"],
    subject="Check out our new features",
    html='<p>Click <a href="https://yourdomain.com/features">here</a> to learn more!</p>',
    track_opens=True,   # Default: True
    track_clicks=True   # Default: True
)
Disable tracking for sensitive emails like password resets or security notifications.

Custom Tracking Domain

By default, tracking links use Ark’s domain. For better branding and deliverability, set up a custom tracking domain.

Step 1: Add the Domain

tracking_domain = client.tracking.domains.create(
    domain="track.yourdomain.com",
    default=True
)

print(f"Domain ID: {tracking_domain.data.id}")
print("Add the following DNS record:")
print(f"  CNAME track.yourdomain.com -> track.arkhq.io")

Step 2: Configure DNS

Add the CNAME record provided in the response:
TypeNameValue
CNAMEtrack.yourdomain.comtrack.arkhq.io

Step 3: Verify

result = client.tracking.domains.verify("trk_abc123")

if result.data.verified:
    print("Tracking domain verified!")
else:
    print("DNS records not found yet")
Now your tracking links will use track.yourdomain.com instead of Ark’s domain.

Receiving Tracking Events

Via Webhooks

Set up webhooks to receive real-time tracking events:
webhook = client.webhooks.create(
    url="https://yourapp.com/webhooks/ark",
    events=["MessageLoaded", "MessageLinkClicked"]
)

print(f"Webhook created: {webhook.data.id}")

Open Event Payload

{
  "type": "email.opened",
  "data": {
    "emailId": "msg_abc123",
    "to": "user@example.com",
    "userAgent": "Mozilla/5.0...",
    "ipAddress": "192.168.1.1",
    "location": {
      "city": "San Francisco",
      "region": "CA",
      "country": "US"
    },
    "timestamp": "2024-01-15T10:30:00Z"
  }
}

Click Event Payload

{
  "type": "email.clicked",
  "data": {
    "emailId": "msg_abc123",
    "to": "user@example.com",
    "url": "https://yourdomain.com/features",
    "userAgent": "Mozilla/5.0...",
    "ipAddress": "192.168.1.1",
    "timestamp": "2024-01-15T10:31:00Z"
  }
}

Via API

Query tracking data directly:
stats = client.tracking.stats.retrieve(
    start_date="2024-01-01",
    end_date="2024-01-31"
)

print(f"Open rate: {stats.data.summary.open_rate}%")
print(f"Click rate: {stats.data.summary.click_rate}%")

Tracking Metrics

MetricDescription
OpensNumber of unique opens
ClicksNumber of unique clicks
Open RateOpens / Delivered * 100
Click RateClicks / Delivered * 100
Click-to-Open RateClicks / Opens * 100
Metrics are deduplicated by recipient. Multiple opens/clicks from the same person count as one.

Tracking Limitations

Open Tracking

  • Image blocking: Many email clients block images by default
  • Privacy features: Apple Mail Privacy Protection, Gmail, and others may preload images, causing false positives
  • Plain text emails: Open tracking only works with HTML emails

Click Tracking

  • Link preview: Some clients preview links, causing false clicks
  • Security scanning: Corporate email systems may scan links
  • Plain text emails: Click tracking only works in HTML emails

Best Practices

Using your own domain improves deliverability and looks more professional.
Disable tracking for sensitive communications and honor user preferences.
Focus on click-through rates to measure actual engagement rather than just opens.

Privacy Considerations

Be transparent about tracking:
  1. Disclose in privacy policy: Mention that you track email engagement
  2. Provide opt-out: Let users disable tracking if requested
  3. Minimize data: Only collect what you need

API Reference

View tracking API documentation