← All guides marginal.sh

How to Attribute Email Clicks to Subject Lines with marginal

Updated June 2026 · Hosted email MCP server

Knowing which subject line earned a click is the difference between guessing and optimizing. This how-to guide walks through using marginal's email MCP server to run a subject line A/B test and tie click activity back to the exact line that drove it — all from your AI agent.

Why attribution starts at the subject line

A subject line's job is to earn the open, but the open alone doesn't tell you whether the line attracted the right reader. By measuring clicks per variant inside a controlled test, you can attribute downstream engagement to the specific subject line that delivered it.

marginal handles the send, the tracking, and the variant bookkeeping for you. Because each recipient is assigned to a single subject line within a test, every tracked click maps cleanly back to its variant — no spreadsheet reconciliation required.

Step 1: Generate and launch a subject line A/B test

Connect marginal to your MCP client — Cursor, Claude Desktop, Claude Code, Windsurf, Cline, Continue, Zed, or OpenAI Codex — and authenticate with your Bearer API key. Then prompt your AI agent to draft candidate subject lines and start the experiment.

Use generate_variants to produce a handful of distinct subject lines for the same campaign, then launch_test to send them across a randomized split of your list. marginal manages the send and begins recording opens and clicks immediately.

Step 2: Read click results and attribute the lift

Once recipients start engaging, call get_results to pull open and click metrics broken out by variant. This is where attribution happens: the click-through numbers are already tied to the subject line each recipient received, so you can see exactly which line moved people to act.

marginal reports within-test lift, so you don't just see that Variant B got more clicks — you see how much more, relative to the others in the same send. That comparison is what lets you confidently attribute click performance to a subject line rather than to timing, list quality, or seasonality.

Step 3: Let your agent recommend the next move

After attribution, close the loop with recommend_next. Your AI agent reads the click-based results and proposes the next experiment — doubling down on the winning angle, testing a sharper hook, or retiring lines that underperformed.

This turns AI agent email marketing into a continuous cycle: generate, launch, attribute, and iterate. The free tier covers 100 experiments per month, which is plenty to build a reliable picture of what your subject lines actually earn. Full setup details live in the marginal docs.

Get started with marginal

marginal is a hosted email marketing MCP server at marginal.sh. Sign up free, create an API key, and connect https://marginal.sh/mcp from Cursor, Codex, or Claude Desktop.

Documentation · Sign up · FAQ