Skip to Content
n8n IntegrationEmail Tracker Node

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:

  1. Register the email with Mailpulse
  2. Replace all links with tracked redirect URLs
  3. Add an invisible tracking pixel for open detection
  4. Return modified HTML ready to send

Input Fields

FieldRequiredTypeDescription
HTML ContentYesStringThe HTML content of your email
Recipient EmailYesStringThe recipient’s email address
SubjectYesStringThe email subject line
CampaignNoSelectHow to assign a campaign
MetadataNoJSONOptional 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:

FieldTypeDescription
modifiedHtmlStringHTML with tracking links and pixel
trackingIdStringUnique tracking ID for this email
recipientStringThe recipient email address
subjectStringThe email subject
linksTrackedNumberCount 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:

  1. Set Campaign to Select Existing
  2. Click the Campaign Name dropdown
  3. Select from your available campaigns

This uses your API credentials to fetch the campaign list.

How Tracking Works

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:

  • href attributes 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)]
Last updated on