Email Analytics
Track opens, clicks, and engagement metrics for your emails.
Overview
Lettr automatically tracks:
- Deliveries - Emails successfully delivered
- Opens - When recipients open your email
- Clicks - When recipients click links
- Bounces - Failed deliveries
- Spam Reports - Marked as spam
- Unsubscribes - Opted out of emails
Enable Tracking
Tracking is enabled by default. You can customize per email:
await lettr.emails.send({
from: 'you@example.com',
to: ['recipient@example.com'],
subject: 'Newsletter',
html: '<p>Content with <a href="https://example.com">link</a></p>',
tracking: {
opens: true,
clicks: true
}
});
Get Email Stats
// Single email
const email = await lettr.emails.get('email_123');
console.log({
opens: email.opens,
clicks: email.clicks,
firstOpenedAt: email.firstOpenedAt,
lastOpenedAt: email.lastOpenedAt
});
Aggregate Analytics
const analytics = await lettr.analytics.get({
startDate: '2024-01-01',
endDate: '2024-01-31',
groupBy: 'day'
});
// Returns daily breakdown
[
{
date: '2024-01-01',
sent: 1000,
delivered: 985,
opened: 350,
clicked: 75,
bounced: 15,
openRate: 35.53,
clickRate: 7.61
},
// ...
]
const campaignStats = await lettr.analytics.get({
startDate: '2024-01-01',
endDate: '2024-01-31',
tags: ['newsletter', 'january-2024']
});
Click Analytics
Get detailed click data:
const clicks = await lettr.analytics.clicks({
emailId: 'email_123'
});
// Returns
{
totalClicks: 150,
uniqueClicks: 75,
links: [
{
url: 'https://example.com/product',
clicks: 100,
uniqueClicks: 50
},
{
url: 'https://example.com/about',
clicks: 50,
uniqueClicks: 25
}
]
}
Dashboard Metrics
Access comprehensive analytics in your Lettr dashboard:
Real-Time Stats
Live email performance monitoring
Historical Data
Up to 90 days of detailed analytics
Engagement Maps
Geographic distribution of opens
Device Breakdown
Desktop vs mobile engagement
Privacy Considerations
Open tracking uses a 1x1 pixel image. Some email clients block images by default, which may result in under-reported open rates.
You can respect user privacy by disabling tracking:
await lettr.emails.send({
from: 'you@example.com',
to: ['privacy-conscious@example.com'],
subject: 'No Tracking Email',
html: '<p>This email is not tracked.</p>',
tracking: {
opens: false,
clicks: false
}
});