Skip to main content
Abstract visualisation of a connected multi-agent system with flowing data streams and glowing nodes

AI & Automation

Track marketing performance with a multi-agent system.

Case 3 of the series — track and report social, SEA and SEO automatically: GA4, Google Ads, Meta, Search Console in a multi-agent stack.

Michael Schranz · AHEAD OF TIME18 min

What this is about

This is Case 3 of the four-part multi-agent systems series. We stay with the multi-agent architecture we built up in Case 2 for B2B sales — and transfer it to marketing performance tracking.

Marketing leads in SMEs are stuck in a data dilemma:

  • Too many channels: Google Ads, Meta Ads (Facebook/Instagram), LinkedIn Ads, TikTok Ads, organic social, SEO, newsletter, affiliate, display
  • Too many tools: GA4, Google Search Console, Google Ads Manager, Meta Ads Manager, LinkedIn Campaign Manager, native social insights, SEO tools (ahrefs, Semrush, Sistrix)
  • Too little time: putting performance reports together eats hours per week — time missing for optimisation

A multi-agent system for marketing can close exactly this gap: collect data automatically, calculate KPIs, identify anomalies, translate them into narrative reports and push them to the right place. In this post you get the full setup. If you would rather outsource the ongoing operation as a SEA performance mandate instead of running everything yourself, that is also a viable path.

Recap — the MAS architecture

We build again on the familiar four-agent architecture:

  1. Marketing Data Collector — collects data from 5–10 sources, normalises it
  2. Marketing Analyst — calculates KPIs, identifies anomalies, builds cohorts
  3. Marketing Interpreter — gives the numbers meaning, writes stories
  4. Marketing Reporter — pushes output into Slack, mail, Notion, dashboard

What is different compared to the sales MAS: more data sources, more API authentication topics (every ad platform has its quirks), more complexity in attribution (see multi-touch attribution for SMEs).

The data sources in 2026 — what you want to integrate

Datenquelle
Standard-Tool
Alternative
Datenmenge / Setup
Google AdsGoogle Ads APILooker Studio ConnectorHoch — täglich, Echtzeit-fähig
Meta AdsMeta Marketing APISupermetricsHoch — täglich, latency 4–24h
GA4GA4 Reporting APIBigQuery-ExportSehr hoch — alle Page-Views, Events
Search ConsoleGSC APILooker Studio ConnectorMittel — täglich, mit 2 Tage Verzug
Looker StudioLooker-Embed-IframeCustom-DashboardHoch — visualisiert Multi-Source
CRM (HubSpot/Salesforce)CRM-APIn8n-WorkflowMittel — Pipeline + Conversion-Daten
Marketing-MAS Tool-Stack pro Datenquelle

Sechs typische Datenquellen im Marketing-MAS-Setup mit Standard-Tool, Alternative und Datenmenge.

Performance marketing (paid)

  • Google Ads API: campaigns, ad groups, ads, keywords, conversions, cost
  • Meta Marketing API: Facebook + Instagram Ads, campaigns, audiences, conversions
  • LinkedIn Marketing API: LinkedIn Ads, Sponsored Content, Lead Gen Forms
  • TikTok Ads API: TikTok campaign data
  • Microsoft Advertising API: Bing Ads (often underestimated in the DACH region)

Organic social

  • Meta Graph API: Facebook + Instagram insights, reach, engagement
  • LinkedIn Company API: follower growth, post performance
  • TikTok Business API: organic TikTok performance
  • YouTube Data API: YouTube analytics, subscriber growth

SEO

  • Google Search Console API: clicks, impressions, ranking positions, top queries
  • Google Analytics 4 API: organic traffic, engagement, conversions
  • Third-party tools (optional): ahrefs, Semrush, Sistrix for competitor data

Analytics & conversion

  • GA4 (Google Analytics 4): master source for conversions, traffic-source attribution
  • Server-side tracking for cookie-free conversions (via Stape, CustomerLabs or DIY with Cloudflare Workers)
  • CRM connection (HubSpot/Pipedrive/Salesforce) for end-to-end attribution

Architecture of the marketing MAS — the four agents in detail

Agent 1 — Marketing Data Collector

Responsibility: daily pulling of all relevant data into a central DB.

Setup per data source:

  1. Set up API credentials (register OAuth app, store refresh token)
  2. n8n workflow per source (cron trigger → API call → normalise data format → DB write)
  3. Error handling (what to do on API outage?)

Output schema (unified across all sources):

date            | 2026-05-27
channel         | google_ads | meta_ads | linkedin_ads | google_organic | linkedin_organic
campaign        | (campaign name)
metric_type     | impressions | clicks | conversions | spend | engagement
metric_value    | (numeric)

Everything goes into a central table "marketing_daily_snapshots". That makes later analysis easy.

Agent 2 — Marketing Analyst

Responsibility: calculate KPIs, spot trends, report anomalies.

Classic KPIs:

  • CPM, CPC, CPA, ROAS per channel per campaign
  • CTR and conversion rate trends
  • Click-to-lead and lead-to-customer conversion (via CRM connection)
  • Channel mix over time
  • Top and bottom performers per channel

Anomaly detection. The analyst agent watches for four typical patterns. Sudden drops show up when conversions on a channel fall by 30 percent or more over three days. Sudden spikes — for example a doubled CPC — usually point to a competitor bid war. Performance regressions are ad sets that previously ran solidly and suddenly collapse, often through audience saturation or creative fatigue. Seasonal oddities show up when the typical weekday pattern deviates and that can't be explained by campaign changes.

Implementation: classic calculations in n8n function nodes (deterministic, cheap). The anomaly detection layer can be LLM-based (or classic via standard-deviation detection).

Agent 3 — Marketing Interpreter

Responsibility: translate KPIs into stories, formulate recommendations.

Sample outputs:

"In the last 7 days, ROAS on Google Ads has dropped from 4.2 to 3.1 — mainly driven by the campaign 'Brand Search DE', where CPC rose by 35%. Recommendation: reduce brand-search budget, since search volume is stable and competitors are probably bidding more."

"LinkedIn Ads is showing unexpectedly strong performance this week: CTR +28%, CPA -22%. Likely cause: the new carousel ad with customer story is performing significantly better than our standard Lead Gen Form. Recommendation: shift budget from standard Lead Gen to carousel ads."

"SEO performance: in Search Console, clicks on 'multi touch attribution sme' have risen by 145% — the corresponding blog post is now in the top 3 for this keyword. Recommendation: tackle similar long-tail topics with the same strategy."

Setup:

[Cron trigger]: daily 07:30
  ↓
[DB node]: fetch KPIs of the last 7 / 30 / 90 days
  ↓
[Claude node]:
  System prompt: "You are a senior marketing performance analyst at a
                  Swiss SME. Identify the 3 most important insights of
                  the day, explain causes with the data, give a concrete
                  recommendation. You-form, Swiss tonality, no fluff."
  User prompt: "Data: [JSON with KPIs of all channels]"
  ↓
[DB node]: write output into "daily_marketing_reports"

Agent 4 — Marketing Reporter

Responsibility: push output to the right audience.

Three audiences, three formats plus an ad-hoc channel:

Daily for the marketing team. Posts at 08:00 to the Slack channel #marketing-daily — three insights, three recommendations, and a mini KPI snapshot for the morning stand-up.

Weekly for the marketing lead and management. Mail with subject "Marketing Performance Week [X]" sent Monday 09:00 — executive summary, channel breakdown and recommendations for the coming week.

Monthly for the entire management team. A Notion doc or Google Slides deck generated on the first working day of the month — full performance report with trends, ROI and Q+1 recommendations.

Ad-hoc alerts. Slack channel #marketing-alerts, triggered by Agent 2 anomalies (performance drop, spend spike, account outage) — each with an action recommendation and an @-mention of the person responsible.

Build/buy/hybrid — what fits which SME?

Buy option — marketing analytics platforms

Mutiny / Triple Whale / Northbeam. AI marketing analytics platforms with connectors to all the usual sources, predictive analytics out of the box (LTV forecasts, spend-allocation recommendations) — at a cost of around 500–5,000 USD per month depending on volume.

Pros. Zero setup, productive immediately, with industry best-practice models built in.

Cons. High running costs, little custom logic for SME specifics, and optimised more for e-commerce than for B2B lead-gen.

When it makes sense: mid-size e-commerce SMEs with significant performance budgets (>50k CHF/month marketing spend).

Buy option — all-in-one marketing tools

HubSpot Marketing Hub with Breeze Reporting Agent delivers similar outputs out of the box, with the advantage of CRM integration.

When it makes sense: SMEs that already use HubSpot and want integrated marketing + sales reporting.

n8n-based MAS with platform connectors, Claude for interpretation, your own DB:

  • n8n Cloud or self-hosted: 24–50 USD/month
  • Claude API: 50–200 USD/month depending on volume
  • PostgreSQL (Supabase or Cloudflare D1): 0–25 USD/month
  • Slack/Notion: typically already in place

Total: 100–350 USD/month all in.

When it makes sense: default recommendation for 80% of SMEs.

Build option — fully custom MAS platform

Your own backend with LangGraph/CrewAI, your own data pipeline (BigQuery / Snowflake), custom reporting frontend. This tier is at its core classic product development and should be guided accordingly.

When it makes sense: larger SMEs with their own tech team, very specific workflows, high data volumes (>1 million events/month).

Step-by-step setup (hybrid variant with n8n + Claude)

Prerequisites

  • GA4 cleanly configured with relevant conversion events
  • Google Search Console verified for your domain
  • API access to all ad platforms you use (Google Ads, Meta Business Manager, LinkedIn Campaign Manager)
  • n8n instance (see Case 1)
  • Slack account with a dedicated channel per report type

Step 1 — set up the Marketing Data Collector

Sample workflow for Google Ads:

[Cron trigger]: daily 06:00
  ↓
[Google Ads node]: query
  "SELECT campaign.name, metrics.impressions, metrics.clicks,
   metrics.cost_micros, metrics.conversions, metrics.conversions_value
   FROM campaign WHERE segments.date = YESTERDAY"
  ↓
[Function node]: normalise data into the unified schema
  ↓
[Postgres node]: insert into marketing_daily_snapshots

Analogously for every ad platform. Setup effort per source: 1–3 hours initially.

Important: a separate workflow per source. If one source has issues, the rest stays functional.

Step 2 — connect GA4 + Search Console

GA4 workflow:

[Cron trigger]: daily 06:30
  ↓
[Google Analytics node]: fetch yesterday's daily aggregate
  Dimensions: date, source, medium, campaign
  Metrics: sessions, engagements, conversions, conversion_value
  ↓
[Postgres node]: insert into marketing_daily_snapshots

Search Console:

[Cron trigger]: daily 07:00
  ↓
[Google Search Console node]: fetch search query data
  Dimensions: date, query, page, country, device
  Metrics: clicks, impressions, ctr, position
  ↓
[Postgres node]: insert into seo_daily_snapshots

Step 3 — set up the Marketing Analyst

[Cron trigger]: daily 07:30
  ↓
[Postgres node]: fetch the last 30 days from snapshots
  ↓
[Function node]: calculate KPIs per channel
  - CPM, CPC, CPA, ROAS
  - Channel mix (% spend per channel)
  - Conversion rate trends
  ↓
[Function node]: anomaly detection
  - If metric_value over the last 7 days > 2 standard deviations from the mean
  - → mark as anomaly + store
  ↓
[Postgres node]: insert into daily_kpis and anomalies

Step 4 — set up the Marketing Interpreter

[Cron trigger]: daily 08:00
  ↓
[Postgres node]: fetch today's KPIs + anomalies + trends 7/30 days
  ↓
[Claude node]:
  System prompt: "Marketing analyst at a Swiss SME. Identify 3 important
                  insights, explain, recommend action. You-form."
  User prompt: "KPIs today: [JSON]. Trends: [JSON]. Anomalies: [JSON]."
  ↓
[Postgres node]: write the daily report

Step 5 — set up the Marketing Reporter

Daily digest:

[Cron trigger]: daily 08:15
  ↓
[Postgres node]: fetch the daily report
  ↓
[Claude node]: shape into Slack Block Kit
  ↓
[Slack node]: post to #marketing-daily

Weekly report:

[Cron trigger]: Monday 09:00
  ↓
[Postgres node]: fetch the last 7 daily reports + trends
  ↓
[Claude node]: create a weekly executive summary
  System prompt: "Write a weekly performance report for management at a
                  Swiss SME. Sections: executive summary,
                  channel breakdown, top wins, top concerns, action for next week."
  ↓
[Gmail/Outlook node]: send mail to marketing lead + management

Monthly deep dive:

[Cron trigger]: 1st of the month 10:00
  ↓
[Postgres node]: fetch the last 30 daily reports
  ↓
[Claude node]: create a comprehensive monthly report
  Sections: executive summary, performance per channel, best performing campaigns,
            competitive insights, trends, Q+1 recommendations
  ↓
[Notion node]: create new doc in the "Marketing Reports" workspace

Step 6 — alert workflows

[Cron trigger]: hourly
  ↓
[Postgres node]: fetch anomalies since the last hour
  ↓
[Switch node]: by severity
  - critical (e.g. account paused, spend >2× budget) → [Slack DM to marketing lead]
  - high (e.g. ROAS -50%) → [Slack #marketing-alerts]
  - medium (e.g. CTR -20%) → include in the daily digest

Value creation — what does this actually deliver?

Realistic orders of magnitude for mid-size SMEs with 3–8 marketing staff and 30k–200k CHF/month marketing spend — as conservative orientation, not a promise from a specific mandate:

  • Reporting effort reduced by 60–80% — from 8–12h/week to 2–3h/week
  • Response time to performance issues: from 5–7 days to <24 hours
  • Spend efficiency: conservatively +3–10% ROAS improvement after 6 months through earlier identification of underperformers
  • Strategic decision quality: marketing leads can focus on strategy / creative instead of reporting

ROI example: SME with 50k CHF/month marketing spend. A conservative ROAS improvement of 5% corresponds to 2'500 CHF additional monthly contribution margin. Tool setup: 350 CHF/month. Even factoring in implementation effort and team adoption, a realistic net ROI of 1.5× to 3× over 12–18 months remains — the saved time not yet included.

Marketing data is a DPA/GDPR hotspot in 2026. Behavioural data, IP addresses, device IDs, cookie IDs — all personal data or potentially de-anonymisable.

What can go to LLMs and third parties?

  • GA4 aggregates (sessions, conversions, source/medium) are usually sufficiently anonymised — can go to an LLM for analysis
  • Ad-platform data (Google Ads, Meta, LinkedIn) partly contains individual conversions — aggregation before the LLM call is mandatory
  • Search Console delivers anonymised search queries — uncritical
  • CRM-linked conversion data (lead → deal connection) is personal — be careful when handing it to an LLM

Specific risks with the marketing MAS

  • Cookie compliance: browser tracking is fragmented in 2026. Anyone building on third-party cookies sees data gaps. Server-side tracking is mandatory — but has to be set up in a DPA-compliant way
  • Personal references in behavioural data: the combination of IP + user-agent + geo can be de-anonymising. The privacy notice has to address that
  • Hallucinations in performance reports: AI invents trends that end up in management decks
  • External sub-processors: GA4 → Google USA. For sensitive industries: alternative web analytics in the EU (Plausible Frankfurt, Matomo self-hosted, Cloudflare Web Analytics EU region)

CH-compliant setup recommendation for the marketing MAS

  • Web analytics: Plausible (Frankfurt), Matomo self-hosted on Swiss cloud, or Cloudflare Web Analytics (cookie-free)
  • Server-side tracking: Stape with EU region or DIY with Cloudflare Workers in a Swiss region
  • Marketing DB: PostgreSQL on exoscale / Infomaniak / Hostpoint
  • LLM layer: Azure OpenAI Switzerland North for interpretation, classic deterministic calculations without LLM where possible
  • Conversion API (CAPI) instead of pixel tracking for Meta, Google → reduces cookie dependency, allows more control over the data flow
  • Aggregation before LLM: no raw user events to Claude/GPT — only aggregated KPIs

Common pitfalls

Pitfall 1 — attribution spaghetti

If your attribution models are not clear (see multi-touch attribution models), your MAS produces contradictory insights. Before MAS rollout, configure attribution cleanly (at minimum activate data-driven attribution in GA4).

Pitfall 2 — vanity metric overload

The Interpreter reports 20 KPIs per day, nobody reads them. Maximum 3 daily insights, clearly prioritised by business impact.

Pitfall 3 — API quotas and rate limits

Google Ads, Meta, LinkedIn have rate limits. With too aggressive polling: account block. Mitigation: set rate-limit nodes in n8n, exponential backoff on errors.

In 2026 the cookie world is fragmented. Browser tracking only partly works. Mitigation:

  • Server-side tracking via Stape or Cloudflare Workers
  • Enhanced Conversions on Google Ads
  • Conversion API (CAPI) on Meta

Pitfall 5 — LLM hallucinations in recommendations

Claude/GPT can deliver recommendations that are not statistically supported in the data. Mitigation:

  • Explicit prompt: "Recommendations only based on data, no speculation. If uncertain: 'further investigation needed'."
  • Before action: every recommendation reviewed by a human
  • Multi-model cross-check for critical decisions (see Thinking traps part 2)

Pitfall 6 — DPA / GDPR with personal data

Marketing data quickly raises personal-reference topics (IP addresses, user IDs, cookies). Mitigation:

  • DPA contracts with all tools
  • Aggregation before LLM handover (no raw user data to Claude/GPT)
  • For sensitive industries: self-hosted models for the interpretation layer

SME setup example: e-commerce SME in Zurich with 60k CHF/month marketing spend

Hypothetical scenario — calculated for orientation, not from a specific mandate. The numbers are plausibly calibrated, but illustrative:

Setup:

  • Data sources: Google Ads, Meta Ads, LinkedIn Ads, GA4, Search Console, Shopify
  • n8n Cloud (Pro plan)
  • Claude Sonnet 4.6 for the Interpreter
  • Supabase as the PostgreSQL DB
  • Slack for daily reporting
  • Notion for monthly reports
  • Google Looker Studio as a dashboard (via the Postgres connector)

Costs:

  • n8n Cloud Pro: 50 USD/month
  • Claude API: about 150 USD/month
  • Supabase: 25 USD/month
  • Total tools: about 225 USD/month = 2'700 USD/year

Implementation effort:

  • 60 hours initially (spread over 4 weeks)
  • 6 hours / month maintenance

Projected result after 4 months (illustrative):

  • Reporting effort in the marketing team from 10h/week to 2–3h/week
  • ROAS improvement from 3.4 to around 3.7 (spend-allocation recommendations implemented)
  • Significantly faster identification of performance problems (days instead of weeks)
  • Net ROI: conservatively 1.5× to 3× over 12–18 months

Showcase architecture: sales MAS + marketing MAS combined

If you build both Case 2 (sales MAS) and this setup, the combination pays off:

  • Shared DB: sales and marketing data in the same Postgres instance
  • Cross-MAS insights: the Marketing Interpreter can use CRM data ("Which campaign brought the most qualified leads?")
  • Closed-loop attribution: marketing data → lead → sales data → actual revenue per channel
  • Shared Reporter: unified reports to management with marketing and sales performance integrated

This is the setup that enables real marketing-mix models and data-driven spend allocation. For mid-size SMEs (50+ employees), high expected value creation.

Workshop / bootcamp: build the marketing MAS together

We build this setup in a 3-day bootcamp or 6-week supporting coaching with your marketing team:

  • Day 1: architecture + tool choice + data audit
  • Day 2: data collector for 3 main channels + GA4 + GSC set up
  • Day 3: Analyst + Interpreter + Reporter with Slack/mail integration
  • Optional days 4–5: custom workflows for your specifics (multi-touch attribution, predictive LTV, etc.)

Output: your marketing team has a productively running MAS and the understanding to extend it autonomously.

30-min call if this is interesting for your SME.

Q&A — the most frequent questions about the marketing MAS

We don't have our own tracking setup. Can we still do this? First set up tracking cleanly (GA4 with custom events, server-side tracking, Enhanced Conversions). Otherwise the MAS stands on a shaky foundation.

Do I need BigQuery / Snowflake or is Postgres enough? For most SMEs (up to roughly 5 million events / month): Postgres or Supabase is more than enough. BigQuery / Snowflake becomes relevant at very high volumes or if you are planning data-science use cases anyway.

How do I verify that the LLM interpretations are correct?

  • Weekly random audit: cross-check 3 insights against raw data
  • Multi-model cross-check: the same question to Claude + GPT, on divergence investigate further
  • Clear prompt guards: "Insights only from data, no speculation"

What does the tracking setup before the MAS cost? GA4 is free. Server-side tracking via Stape about 30 USD/month. Enhanced Conversions are free but require setup effort. Realistically a total of 30–80 USD/month plus 8–20 hours of setup time.

Can organic social posts also flow into the MAS? Yes. Meta Graph API, LinkedIn Company API, TikTok Business API deliver organic insights. Setup per source 1–2 hours.

What about newsletter and email marketing? Of course — Klaviyo, ActiveCampaign, Brevo, HubSpot Marketing all have APIs. Simply integrate as a further data source. Newsletter is often one of the most profitable channels, so it is definitely worthwhile in the MAS.

How long until ROI is visible? Reporting time savings: from day 1. Performance optimisation through earlier insights: after 4–8 weeks. Structural ROAS improvement: after 3–6 months.

Where you should read on now

Sources and further reading

  • Google (2024). Ads API Documentation.
  • Meta (2024). Marketing API Documentation.
  • LinkedIn (2024). Marketing API Documentation.
  • Google (2024). Analytics 4 API Documentation.
  • Google (2024). Search Console API Documentation.
  • n8n (2024). Documentation.
  • Anthropic (2024). Claude API Documentation.
  • Plausible (2024). Documentation.

This list covers the primary sources for the concepts discussed in this article. It is not exhaustive but should provide an entry point for those interested in going deeper.

Link copied

Let's talk — no sales pressure.

Tell us about your project. We'll come back with a concrete answer, not a sales email.

Book a 30-min call

A no-obligation 30-min intro call — we listen, you decide.

Or write to us
Link copied