← All guides marginal.sh

How to measure email opens and clicks programmatically

Updated June 2026 · Hosted email MCP server

This marginal MCP tutorial walks through how to measure email opens and clicks programmatically — from launching a tracked send to reading lift metrics straight from your AI agent. No dashboard hopping, no spreadsheet exports.

What you need before you start

marginal is a hosted email marketing MCP server, so there is nothing to deploy. You connect an MCP-capable client to the endpoint, authenticate with a Bearer API key, and call tools directly from your agent.

Step 1: Launch a tracked send

Open/click tracking is built into managed sends, so the act of launching is also the act of starting measurement. Use launch_test to fire a campaign — or a subject line A/B test if you want comparative numbers across variants.

If you are testing subject lines, generate options with generate_variants first, then pass them into launch_test. Each variant is tracked independently, which is what makes a meaningful subject line A/B test possible.

Step 2: Read opens and clicks programmatically

Once a send is live, call get_results to measure email opens and clicks programmatically. The tool returns per-variant engagement and within-test lift metrics, so an AI agent email marketing workflow can compare performance without manual aggregation.

Because results come back as structured data, your agent can act on them directly — flag a winning variant, summarize engagement, or trigger follow-up logic in the same conversation.

Step 3: Let the agent decide what to send next

Measurement is most useful when it feeds a decision. After get_results, call recommend_next to have marginal suggest the next move based on the opens and clicks you just measured. This closes the loop from send to insight to action.

The free tier covers 100 experiments per month, which is plenty to wire up and validate this flow end to end. See the full tool reference in the docs at https://marginal.sh/docs/ and the endpoint at https://marginal.sh/mcp.

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