MarTech Stack Integration
Overview
The modern marketing technology (MarTech) stack comprises 10-30 tools spanning email, analytics, customer data platforms (CDPs), attribution, push notifications, and campaign orchestration. AI agents that can operate across this stack enable unified customer journeys, automated campaign optimization, and real-time personalization. This skill covers the key MarTech APIs and integration patterns.
When to Use This Skill
- Building unified marketing automation with AI-powered orchestration
- Integrating Customer Data Platforms (CDPs) with campaign tools
- Automating email marketing workflows and A/B testing
- Implementing cross-channel attribution modeling
- Creating MCP servers for marketing operations
Core Concepts
MarTech Stack Architecture
┌─────────────┐
│ CDP │ (Segment, mParticle)
│ Unified │
│ Customer │
│ Profile │
└──────┬──────┘
│
┌────────────────┼────────────────┐
│ │ │
┌─────▼─────┐ ┌─────▼─────┐ ┌─────▼─────┐
│ Email │ │ In-App │ │ Ads │
│ Mailchimp │ │ Braze │ │ Meta/ │
│ SendGrid │ │ OneSignal │ │ Google │
└─────┬─────┘ └─────┬─────┘ └─────┬─────┘
│ │ │
└────────────────┼────────────────┘
│
┌──────▼──────┐
│ Analytics │ (Mixpanel, Amplitude, GA4)
│ Attribution│ (AppsFlyer, Branch)
└─────────────┘
Key MarTech Categories
| Category |
Purpose |
Key Players |
API Quality |
| CDP |
Unified customer profiles |
Segment, mParticle |
Excellent |
| Email |
Campaigns, transactional |
Mailchimp, SendGrid, Klaviyo |
Good |
| Product Analytics |
User behavior tracking |
Mixpanel, Amplitude, PostHog |
Good |
| Push/In-App |
Mobile engagement |
Braze, OneSignal |
Good |
| Attribution |
Channel attribution |
AppsFlyer, Branch, Triple Whale |
Moderate |
| A/B Testing |
Experimentation |
LaunchDarkly, Statsig, Optimizely |
Good |
Implementation Guide
Segment CDP Integration
import Analytics from "@segment/analytics-node";
const analytics = new Analytics({ writeKey: process.env.SEGMENT_WRITE_KEY });
// Track user events
analytics.track({
userId: "user_123",
event: "Purchase Completed",
properties: {
orderId: "ORD-456",
revenue: 99.99,
currency: "USD",
products: [
{ id: "SKU-001", name: "Pro Plan", price: 99.99 },
],
},
});
// Identify user with traits
analytics.identify({
userId: "user_123",
traits: {
email: "user@example.com",
plan: "pro",
company: "Acme Corp",
lifecycleStage: "customer",
ltv: 1199.88,
},
});
Email Marketing (Mailchimp)
import mailchimp from "@mailchimp/mailchimp_marketing";
mailchimp.setConfig({ apiKey: process.env.MAILCHIMP_API_KEY, server: "us1" });
// Create and send a campaign
async function createCampaign(listId, subject, htmlContent) {
const campaign = await mailchimp.campaigns.create({
type: "regular",
recipients: { list_id: listId },
settings: {
subject_line: subject,
from_name: "Your Brand",
reply_to: "hello@yourbrand.com",
},
});
await mailchimp.campaigns.setContent(campaign.id, { html: htmlContent });
// Send immediately or schedule
await mailchimp.campaigns.send(campaign.id);
return campaign;
}
// Get campaign performance
async function getCampaignReport(campaignId) {
const report = await mailchimp.reports.getCampaignReport(campaignId);
return {
sent: report.emails_sent,
opens: report.opens.unique_opens,
openRate: report.opens.open_rate,
clicks: report.clicks.unique_clicks,
clickRate: report.clicks.click_rate,
unsubscribes: report.unsubscribed,
bounces: report.bounces.hard_bounces + report.bounces.soft_bounces,
};
}
Marketing Analytics MCP Server
server.tool(
"get_campaign_analytics",
"Get performance metrics for marketing campaigns across channels",
{
channel: z.enum(["email", "push", "sms", "in-app", "all"]),
period: z.enum(["last_7d", "last_30d", "last_90d"]),
},
async ({ channel, period }) => {
const campaigns = await getCampaigns(channel, period);
const summary = campaigns.map(c => ({
name: c.name,
channel: c.channel,
sent: c.sent,
delivered: c.delivered,
opened: c.opened,
clicked: c.clicked,
converted: c.converted,
revenue: c.revenue,
}));
const totals = {
sent: summary.reduce((s, c) => s + c.sent, 0),
revenue: summary.reduce((s, c) => s + c.revenue, 0),
};
return {
content: [{
type: "text",
text: `Marketing Performance (${period}):\n` +
`Total Sent: ${totals.sent.toLocaleString()} | Revenue: $${totals.revenue.toLocaleString()}\n\n` +
summary.map(c =>
`${c.name} (${c.channel}): ${c.sent} sent → ${c.opened} opened (${(c.opened/c.sent*100).toFixed(1)}%) → ${c.converted} converted → $${c.revenue}`
).join("\n"),
}],
};
}
);
Cross-Channel Customer Journey
class CustomerJourney:
"""Track and orchestrate cross-channel customer touchpoints."""
def get_journey(self, user_id):
touchpoints = self.cdp.get_events(user_id, last_days=90)
return {
"user_id": user_id,
"first_touch": touchpoints[0] if touchpoints else None,
"last_touch": touchpoints[-1] if touchpoints else None,
"total_touchpoints": len(touchpoints),
"channels_used": list(set(t.channel for t in touchpoints)),
"journey_stage": self.classify_stage(touchpoints),
"next_best_action": self.recommend_action(touchpoints),
}
def recommend_action(self, touchpoints):
"""AI-powered next best action recommendation."""
recent = touchpoints[-5:]
if not recent:
return {"action": "welcome_email", "channel": "email"}
channels_used = set(t.channel for t in recent)
if "email" in channels_used and "push" not in channels_used:
return {"action": "push_notification", "channel": "push"}
if any(t.event == "pricing_page_view" for t in recent):
return {"action": "sales_outreach", "channel": "email", "priority": "high"}
return {"action": "nurture_content", "channel": "email"}
Best Practices
- CDP as the hub — route all customer data through a CDP, not point-to-point
- Event naming conventions — use consistent
Object Action format (e.g., "Order Completed")
- Respect consent — check opt-in status before every outbound touchpoint
- Deduplicate contacts — merge profiles across channels using email/phone as keys
- Attribution windows — set clear attribution windows (7-day click, 1-day view)
- A/B test everything — subject lines, send times, content, and CTAs
Resources
Changelog
| Version |
Date |
Changes |
| 1.0.0 |
2026-03-31 |
Initial documentation |
1---2name: martech-stack3description: Integrate and automate marketing technology stacks including email marketing, analytics, CDP, attribution, and campaign orchestration across platforms like Mailchimp, Segment, Mixpanel, and Braze.4license: Apache 2.05---6
7# MarTech Stack Integration
8
9## Overview
10
11The modern marketing technology (MarTech) stack comprises 10-30 tools spanning email, analytics, customer data platforms (CDPs), attribution, push notifications, and campaign orchestration. AI agents that can operate across this stack enable unified customer journeys, automated campaign optimization, and real-time personalization. This skill covers the key MarTech APIs and integration patterns.
12
13## When to Use This Skill
14
15- Building unified marketing automation with AI-powered orchestration
16- Integrating Customer Data Platforms (CDPs) with campaign tools
17- Automating email marketing workflows and A/B testing
18- Implementing cross-channel attribution modeling
19- Creating MCP servers for marketing operations
20
21## Core Concepts
22
23### MarTech Stack Architecture
24
25```
26 ┌─────────────┐
27 │ CDP │ (Segment, mParticle)
28 │ Unified │
29 │ Customer │
30 │ Profile │
31 └──────┬──────┘
32 │
33 ┌────────────────┼────────────────┐
34 │ │ │
35 ┌─────▼─────┐ ┌─────▼─────┐ ┌─────▼─────┐
36 │ Email │ │ In-App │ │ Ads │
37 │ Mailchimp │ │ Braze │ │ Meta/ │
38 │ SendGrid │ │ OneSignal │ │ Google │
39 └─────┬─────┘ └─────┬─────┘ └─────┬─────┘
40 │ │ │
41 └────────────────┼────────────────┘
42 │
43 ┌──────▼──────┐
44 │ Analytics │ (Mixpanel, Amplitude, GA4)
45 │ Attribution│ (AppsFlyer, Branch)
46 └─────────────┘
47```
48
49### Key MarTech Categories
50
51| Category | Purpose | Key Players | API Quality |
52|----------|---------|-------------|-------------|
53| CDP | Unified customer profiles | Segment, mParticle | Excellent |
54| Email | Campaigns, transactional | Mailchimp, SendGrid, Klaviyo | Good |
55| Product Analytics | User behavior tracking | Mixpanel, Amplitude, PostHog | Good |
56| Push/In-App | Mobile engagement | Braze, OneSignal | Good |
57| Attribution | Channel attribution | AppsFlyer, Branch, Triple Whale | Moderate |
58| A/B Testing | Experimentation | LaunchDarkly, Statsig, Optimizely | Good |
59
60## Implementation Guide
61
62### Segment CDP Integration
63
64```typescript
65import Analytics from "@segment/analytics-node";
66
67const analytics = new Analytics({ writeKey: process.env.SEGMENT_WRITE_KEY });
68
69// Track user events
70analytics.track({
71 userId: "user_123",
72 event: "Purchase Completed",
73 properties: {
74 orderId: "ORD-456",
75 revenue: 99.99,
76 currency: "USD",
77 products: [
78 { id: "SKU-001", name: "Pro Plan", price: 99.99 },
79 ],
80 },
81});
82
83// Identify user with traits
84analytics.identify({
85 userId: "user_123",
86 traits: {
87 email: "user@example.com",
88 plan: "pro",
89 company: "Acme Corp",
90 lifecycleStage: "customer",
91 ltv: 1199.88,
92 },
93});
94```
95
96### Email Marketing (Mailchimp)
97
98```typescript
99import mailchimp from "@mailchimp/mailchimp_marketing";
100
101mailchimp.setConfig({ apiKey: process.env.MAILCHIMP_API_KEY, server: "us1" });
102
103// Create and send a campaign
104async function createCampaign(listId, subject, htmlContent) {
105 const campaign = await mailchimp.campaigns.create({
106 type: "regular",
107 recipients: { list_id: listId },
108 settings: {
109 subject_line: subject,
110 from_name: "Your Brand",
111 reply_to: "hello@yourbrand.com",
112 },
113 });
114
115 await mailchimp.campaigns.setContent(campaign.id, { html: htmlContent });
116
117 // Send immediately or schedule
118 await mailchimp.campaigns.send(campaign.id);
119 return campaign;
120}
121
122// Get campaign performance
123async function getCampaignReport(campaignId) {
124 const report = await mailchimp.reports.getCampaignReport(campaignId);
125 return {
126 sent: report.emails_sent,
127 opens: report.opens.unique_opens,
128 openRate: report.opens.open_rate,
129 clicks: report.clicks.unique_clicks,
130 clickRate: report.clicks.click_rate,
131 unsubscribes: report.unsubscribed,
132 bounces: report.bounces.hard_bounces + report.bounces.soft_bounces,
133 };
134}
135```
136
137### Marketing Analytics MCP Server
138
139```typescript
140server.tool(
141 "get_campaign_analytics",
142 "Get performance metrics for marketing campaigns across channels",
143 {
144 channel: z.enum(["email", "push", "sms", "in-app", "all"]),
145 period: z.enum(["last_7d", "last_30d", "last_90d"]),
146 },
147 async ({ channel, period }) => {
148 const campaigns = await getCampaigns(channel, period);
149
150 const summary = campaigns.map(c => ({
151 name: c.name,
152 channel: c.channel,
153 sent: c.sent,
154 delivered: c.delivered,
155 opened: c.opened,
156 clicked: c.clicked,
157 converted: c.converted,
158 revenue: c.revenue,
159 }));
160
161 const totals = {
162 sent: summary.reduce((s, c) => s + c.sent, 0),
163 revenue: summary.reduce((s, c) => s + c.revenue, 0),
164 };
165
166 return {
167 content: [{
168 type: "text",
169 text: `Marketing Performance (${period}):\n` +
170 `Total Sent: ${totals.sent.toLocaleString()} | Revenue: $${totals.revenue.toLocaleString()}\n\n` +
171 summary.map(c =>
172 `${c.name} (${c.channel}): ${c.sent} sent → ${c.opened} opened (${(c.opened/c.sent*100).toFixed(1)}%) → ${c.converted} converted → $${c.revenue}`
173 ).join("\n"),
174 }],
175 };
176 }
177);
178```
179
180### Cross-Channel Customer Journey
181
182```python
183class CustomerJourney:
184 """Track and orchestrate cross-channel customer touchpoints."""
185
186 def get_journey(self, user_id):
187 touchpoints = self.cdp.get_events(user_id, last_days=90)
188
189 return {
190 "user_id": user_id,
191 "first_touch": touchpoints[0] if touchpoints else None,
192 "last_touch": touchpoints[-1] if touchpoints else None,
193 "total_touchpoints": len(touchpoints),
194 "channels_used": list(set(t.channel for t in touchpoints)),
195 "journey_stage": self.classify_stage(touchpoints),
196 "next_best_action": self.recommend_action(touchpoints),
197 }
198
199 def recommend_action(self, touchpoints):
200 """AI-powered next best action recommendation."""
201 recent = touchpoints[-5:]
202 if not recent:
203 return {"action": "welcome_email", "channel": "email"}
204
205 channels_used = set(t.channel for t in recent)
206 if "email" in channels_used and "push" not in channels_used:
207 return {"action": "push_notification", "channel": "push"}
208 if any(t.event == "pricing_page_view" for t in recent):
209 return {"action": "sales_outreach", "channel": "email", "priority": "high"}
210
211 return {"action": "nurture_content", "channel": "email"}
212```
213
214## Best Practices
215
2161. **CDP as the hub** — route all customer data through a CDP, not point-to-point
2172. **Event naming conventions** — use consistent `Object Action` format (e.g., "Order Completed")
2183. **Respect consent** — check opt-in status before every outbound touchpoint
2194. **Deduplicate contacts** — merge profiles across channels using email/phone as keys
2205. **Attribution windows** — set clear attribution windows (7-day click, 1-day view)
2216. **A/B test everything** — subject lines, send times, content, and CTAs
222
223## Resources
224
225- [Segment Documentation](https://segment.com/docs/)
226- [Mailchimp API](https://mailchimp.com/developer/)
227- [Mixpanel API Reference](https://developer.mixpanel.com/)
228- [Braze API Guide](https://www.braze.com/docs/api/)
229
230## Changelog
231
232| Version | Date | Changes |
233|---------|------|---------|
234| 1.0.0 | 2026-03-31 | Initial documentation |