Marketing

Lead source to revenue attribution

Measure marketing ROI by source: trace channels and campaigns through to closed revenue by joining CRM deals with payment records, so revenue per lead and return on spend are known instead of stopping at lead counts.

  • +1
    Which lead sources close the most deals?
  • +1
    What's our revenue per lead by channel?
  • +1
    Do CRM closed-won numbers match what got paid?

The playbook

Most channel reports stop at leads. The channel producing the most leads is frequently not the one producing the most revenue, and that gap is the entire point of this analysis.

Steps

  1. Understand the CRM shape before querying it. Call hubspot.list_properties for contacts and deals to find the actual source field β€” it may be hs_analytics_source, a custom property, or something team-specific. Call hubspot.list_pipelines for deals to learn which stage IDs mean "closed won". Do not hardcode either; they differ per account.

  2. Pull deals with their source and value. hubspot.search_deals with filterGroups scoping to the period, requesting properties including deal name, amount, close date, stage, and the source property you identified. Page through with after until complete β€” a partial pull silently biases every number downstream.

  3. Pull the contacts behind those deals via hubspot.search_contacts when you need the original acquisition source rather than the deal-level one. The deal source is often inherited or overwritten; the contact's first-touch source is usually closer to the truth.

  4. Reconcile against actual payments. CRM "closed won" is a human-entered state; money received is not. Use stripe.list_charges or stripe.list_invoices (with status: "paid"), or dodo_payments.list_payments with status: "succeeded", over the same window and compare totals. Where they diverge, trust the payment provider for revenue and report the discrepancy β€” it's usually a finding in its own right.

  5. Add top-of-funnel volume for context. google_analytics.run_report with dimensions: ["sessionSourceMedium"] and metrics: ["sessions", "conversions"] shows how much traffic each channel needed to produce those deals.

  6. Report. One row per source: sessions, leads, deals created, deals won, revenue, and revenue per lead. Sort by revenue. Then explicitly contrast the lead-volume ranking against the revenue ranking β€” where they disagree is the recommendation.

Gotchas

  • Attribution windows. A deal closing this month may come from a lead generated months ago. Attributing by close date credits whatever channel was running then. Prefer joining on the contact's original source and note the lag.
  • HubSpot source values are messy. Free-text and legacy values proliferate. Normalize case and obvious duplicates before grouping, and say what you merged.
  • Stripe amounts are in the smallest currency unit (cents). Divide by 100 before reporting, and don't sum across currencies without converting β€” if multiple currencies appear, report them separately.
  • Deleted or test deals frequently sit in CRM data. Sanity-check the total against a known figure before presenting it.
  • Small numbers aren't signal. A channel with 3 deals and one large contract will top a revenue-per-lead table. Report deal counts alongside so the reader can see the sample size.

Install

Install Sequel skills into your agent

Pick your app and Sequel installs itself: a one-click link where the client supports it, that client’s own few steps where it doesn’t. The playbooks come with the server: your agent sees that this playbook exists and reads it when a question matches.

Claude, ChatGPT, Cursor, VS Code, Claude Code, Codex, Grok, Muse, dots and any other MCP app

Already have an MCP client?

https://api.sequel.sh/mcp

Add it as a remote (streamable HTTP) server and sign in when prompted. Skills come with it; nothing else to install. Manual setup per client

Choose your app

  • Claude

    One click, opens in the app

  • Cursor

    One click, opens in the app

  • VS Code

    One click, opens in the app

  • ChatGPT

    Turn on developer mode, then add Sequel. About two minutes.

  • Claude Code

    Run one command, then sign in with /mcp.

  • Codex

    Run one command, then sign in.

  • Gemini CLI

    Run one command, then sign in with /mcp auth.

  • Grok

    Add Sequel as a connector and sign in.

  • Grok Bot

    Paste this to the bot. It registers Sequel and asks you to sign in.

  • Muse

    Muse writes its own connector. One message is the whole setup.

  • dots

    Add Sequel in ChatGPT; your dot picks it up with no extra step.

  • OpenCode

    Add Sequel as a remote server from the OpenCode CLI.

  • Other MCP app

    Any client that speaks remote MCP can connect with this URL.

FAQ

Frequently asked questions

What is lead source to revenue attribution?
Tracing which marketing source first acquired a lead all the way through to closed revenue in your CRM. It answers which channels generate leads that actually become customers, not just leads. A channel that produces many leads but zero closed deals is a volume metric that looks good but costs money.
What is the difference between first-touch and last-touch attribution?
First-touch credits the first interaction that brought the lead to your site. Last-touch credits the final interaction before conversion. Neither is complete. HubSpot defaults to first-touch from its own tracking cookie. GA4 defaults to last non-direct click. Report both and say which you used.
How do I connect HubSpot leads to marketing channels?
HubSpot stores the original traffic source on each contact as hs_analytics_source and the first landing page as hs_analytics_first_url. Search contacts filtered by source and group by first URL path. Join to Search Console or GA4 channel data on the path to build the lead source picture.
Why are some HubSpot leads showing as offline or unknown source?
Leads from cold email outreach, conference list uploads, or any source without the HubSpot tracking pixel will show as unknown. This is normal for outbound-heavy businesses. Report known-source leads as a share of total leads so the reader understands the coverage.
Can an AI agent run lead source to revenue attribution?
Yes. With HubSpot, Search Console, and GA4 connected, the agent joins lead source data with closed deals and returns revenue and pipeline by source with trend data. Sequel provides all three connections over MCP and the lead-source-to-revenue-attribution playbook.

Put this playbook to work

Connect a source, ask the question, and the agent follows these steps. Free to start.