Email Tracker Node
The Email Tracker node adds open and click tracking to your emails before sending.
Overview
Place the Email Tracker node before your email sending node (Gmail, SMTP, SendGrid, etc.). It will:
- Register the email with Mailpulse
- Replace all links with tracked redirect URLs
- Add an invisible tracking pixel for open detection
- Return modified HTML ready to send
Input Fields
| Field | Required | Type | Description |
|---|---|---|---|
| HTML Content | Yes | String | The HTML content of your email |
| Recipient Email | Yes | String | The recipient’s email address |
| Subject | Yes | String | The email subject line |
| Campaign | No | Select | How to assign a campaign |
| Metadata | No | JSON | Optional metadata to store |
Campaign Options
The Campaign field has three options:
- None - Email won’t be associated with any campaign
- Select Existing - Choose from your existing campaigns (dropdown)
- Create New - Enter a name for a new campaign
When you select “Create New”, entering a campaign name will:
- Use an existing campaign if one with that name exists
- Create a new campaign if it doesn’t exist
Metadata
Store additional data with each email as JSON:
{
"userId": "user_123",
"plan": "premium",
"source": "onboarding"
}This metadata is stored in Mailpulse and can be retrieved via the API.
Output
The node outputs a single item with these fields:
| Field | Type | Description |
|---|---|---|
modifiedHtml | String | HTML with tracking links and pixel |
trackingId | String | Unique tracking ID for this email |
recipient | String | The recipient email address |
subject | String | The email subject |
linksTracked | Number | Count of links that were tracked |
Example Output
{
"modifiedHtml": "<html>... (with tracking) ...</html>",
"trackingId": "hE4kJ9",
"recipient": "user@example.com",
"subject": "Welcome to our service!",
"linksTracked": 3
}Workflow Examples
Basic Email Tracking
[Manual Trigger] → [Set HTML] → [Email Tracker] → [Send Email (Gmail)]Set HTML Node:
{
"html": "<html><body><a href='https://example.com'>Click here</a></body></html>",
"recipient": "user@example.com",
"subject": "Test Email"
}Email Tracker Node:
- HTML Content:
{{ $json.html }} - Recipient Email:
{{ $json.recipient }} - Subject:
{{ $json.subject }}
Send Email Node:
- HTML Body:
{{ $json.modifiedHtml }}
With Dynamic Recipients
[Spreadsheet] → [Email Tracker] → [Send Email]Process a list of recipients from a spreadsheet, tracking each email:
Email Tracker Node:
- HTML Content:
{{ $('Set Email Template').first().json.html }} - Recipient Email:
{{ $json.email }} - Subject:
Hello {{ $json.firstName }}! - Campaign: Create New →
Newsletter {{ new Date().toISOString().slice(0,7) }}
Using Campaign Selection
The dropdown for “Select Existing” dynamically loads your campaigns from Mailpulse:
- Set Campaign to Select Existing
- Click the Campaign Name dropdown
- Select from your available campaigns
This uses your API credentials to fetch the campaign list.
How Tracking Works
Link Tracking
All <a href="..."> links in your HTML are replaced:
Before:
<a href="https://example.com/signup">Sign up</a>After:
<a href="NEXT_PUBLIC_BASE_URL/t/click/abc123">Sign up</a>When clicked, the user is redirected through Mailpulse (recording the click) then to the original URL.
Open Tracking
A 1x1 invisible pixel is added to the email:
<img src="NEXT_PUBLIC_BASE_URL/t/open/abc123" width="1" height="1" style="display:none;" alt="" />When the email is opened and images are loaded, the open is recorded.
Tips
Preserving HTML Structure
The node uses Cheerio to parse and modify HTML. It preserves your HTML structure while only modifying:
hrefattributes in<a>tags- Appending the tracking pixel before
</body>
Multiple Recipients
When processing multiple items (e.g., from a spreadsheet), each recipient gets:
- Their own unique tracking ID
- Their own tracked links
- Individual analytics in the dashboard
Conditional Tracking
Use n8n’s IF node to conditionally track emails:
[Get Data] → [IF should track] → [Email Tracker] → [Send Email]
↓
[Send Email (no tracking)]Error Handling
If the Mailpulse API is unavailable, the node will throw an error. Consider using:
- Error Workflow - To handle failures gracefully
- Retry Logic - Wait and retry on temporary failures
Example error workflow that sends the email without tracking if Mailpulse fails:
[Email Tracker] → [Send Email]
↓ (error)
[Send Email (original HTML)]