How to Automate Win/Loss Analysis With AI
Most win/loss analysis is manual, incomplete, and 60 days late. Here's how to build an AI agent that runs automatically on every closed deal, extracts structured reasons from call transcripts and CRM data, and surfaces patterns your team can act on.
Win/loss analysis is one of those things every sales org says they do and almost none of them do consistently. The reason is friction: someone has to pull the data, interview the rep, read the call transcript, write up the summary, and then aggregate it across enough deals to see patterns. That takes time most teams don’t have.
An AI agent removes most of that friction. It runs automatically on every closed deal, extracts structured reasons from the data you already have, and builds a pattern database without anyone adding it to their to-do list.
What most win/loss programs miss
The typical win/loss process relies on rep-reported reasons. The rep closes a deal as lost, picks a reason from a dropdown (“Price,” “Competitor,” “No Decision”), and that’s the data. There are two problems with this.
First, reps don’t always know why they lost. The prospect didn’t tell them “your product is harder to use than the alternative” - they said “we’re going a different direction.” The rep picks “Competitor” because that’s closest.
Second, even when reps know, they underreport competitive losses (it feels like an indictment of their skills) and overreport price losses (external, blameless).
The data you actually have - call transcripts from Gong, email threads, HubSpot activity logs, deal stage history - tells a more complete story. An AI agent reading that data surfaces reasons the rep couldn’t or wouldn’t report themselves.
What the agent reads
For each closed deal, the agent pulls:
CRM data: deal value, stage history (time spent in each stage), close reason (rep’s self-reported reason), competitor field, contact roles, deal age.
Call transcripts: every Gong call associated with the deal. These are the richest source - pricing discussions, objections raised, feature gaps mentioned, competing tools named.
Email activity: last email sent date, response rate, time from last email to close. A long gap with no response before a lost deal tells a story.
Deal progression: did the deal stall in a particular stage? How many times did the close date slip? These patterns often indicate where the deal broke down even without explicit language.
Step-by-step: building the win/loss agent
Step 1: Set the trigger
In n8n, add a HubSpot trigger node set to watch for Deal Stage Changed events where the new stage is closedwon or closedlost.
Alternatively, run a Schedule Trigger daily that queries for deals closed in the last 24 hours. This approach is more reliable if your HubSpot webhook volume is high.
Step 2: Pull deal data
Add a HubSpot node set to Get Deal. Fetch these properties:
dealname,amount,closedate,dealstagehs_deal_stage_probabilityhistory (stage progression)closed_lost_reason(the rep’s dropdown selection)competitor(if you have this field)hubspot_owner_id- Associated contacts and their job titles
Add a second HubSpot node to get the deal’s engagement timeline - emails, calls, meetings logged. Pull the last 90 days of activity.
Step 3: Pull call transcripts from Gong
Add an HTTP Request node to call the Gong API:
GET https://api.gong.io/v2/calls?fromDateTime={{ dealCreatedDate }}&toDateTime={{ dealCloseDate }}&primaryUserIds={{ repGongUserId }}
This returns calls within the deal’s timeline for the deal owner. Filter further by participant email to match the deal’s contacts.
For each call returned, make a second Gong API call to fetch the transcript:
GET https://api.gong.io/v2/calls/transcript?ids={{ callId }}
Add a Code node to flatten all transcripts into a single text block, prefixed with call date:
const transcripts = $input.all().map(item => {
const date = item.json.metaData.started;
const sentences = item.json.callTranscripts[0].transcript
.flatMap(s => s.sentences.map(sent => `${s.speakerName}: ${sent.text}`))
.join('\n');
return `--- Call on ${date} ---\n${sentences}`;
});
return [{ json: { allTranscripts: transcripts.join('\n\n') } }];
Step 4: Call Claude to extract structured win/loss data
Add an HTTP Request node to call the Claude API.
{
"model": "claude-opus-4-6",
"max_tokens": 1000,
"messages": [{
"role": "user",
"content": "You are a sales intelligence analyst. Analyze this closed deal and extract structured win/loss information.\n\nDeal outcome: {{ $json.dealstage }} (Won or Lost)\nDeal value: ${{ $json.amount }}\nDeal age: {{ $json.dealAgeDays }} days\nRep-reported reason: {{ $json.closedLostReason }}\nStage history: {{ $json.stageHistory }}\n\nCall transcripts:\n{{ $json.allTranscripts }}\n\nReturn ONLY valid JSON:\n{\n \"outcome\": \"Won\" or \"Lost\",\n \"primary_reason\": \"the single most important factor\",\n \"secondary_reasons\": [\"list of contributing factors\"],\n \"competitor_mentioned\": \"name of competitor if any (or null)\",\n \"price_sensitivity\": \"None\" or \"Moderate\" or \"High\" (based on transcript evidence),\n \"feature_gaps\": [\"specific features or capabilities the prospect mentioned needing\"],\n \"deal_breakers\": [\"things the prospect said were non-negotiable that we missed\"],\n \"what_worked\": [\"specific things that resonated with the prospect, won deals only\"],\n \"stage_where_deal_was_decided\": \"the stage where the outcome became likely based on signals\",\n \"confidence\": \"High\" or \"Medium\" or \"Low\" (based on how much data was available),\n \"analysis_summary\": \"3-4 sentences on what happened in this deal and why\"\n}"
}]
}
Step 5: Write structured data back to HubSpot
Create custom HubSpot Deal properties for win/loss data:
wl_primary_reason- Textwl_competitor- Textwl_feature_gaps- Multi-line textwl_price_sensitivity- Dropdown (None/Moderate/High)wl_stage_decided- Textwl_summary- Multi-line textwl_confidence- Text
Add a HubSpot node to update the deal with Claude’s output.
This turns every closed deal into a structured data point rather than a freeform note.
Step 6: Log to a win/loss database
Create a Google Sheet (or Notion database) as your win/loss aggregate table. Add a Google Sheets node to append a row for each analyzed deal with all the structured fields.
This is your pattern layer. After 30-40 deals, you can filter and pivot: “Show me all lost deals where competitor = Competitor X” or “Show me all won deals where price_sensitivity = High” (you close on value, not price, with those accounts).
Step 7: Notify the rep and manager
Add a Slack node to DM the rep with a summary of the closed deal analysis. Keep it brief - one paragraph plus the primary reason:
*Win/Loss analysis complete: {{ dealName }}*
{{ analysis_summary }}
Primary factor: {{ primary_reason }}
{{ if competitor_mentioned }}Competitor: {{ competitor_mentioned }}{{ end }}
Full details logged to HubSpot.
For lost deals, also DM the sales manager so they’re aware of the analysis before the next 1:1.
Building the monthly pattern report
Individual deal analysis is useful. Aggregate patterns are where the real leverage is.
Set up a second workflow that runs on the first Monday of each month:
- Pull all deals closed in the prior month from your Google Sheet
- Pass the aggregate data to Claude with a pattern analysis prompt
- Post the summary to #sales-ops Slack
The pattern prompt:
Here is our win/loss data for last month:
Won deals ({{ count }}): {{ summary of won deal reasons }}
Lost deals ({{ count }}): {{ summary of lost deal reasons }}
Identify:
1. The top 3 recurring reasons we won
2. The top 3 recurring reasons we lost
3. Any competitors we're losing to and what the pattern looks like
4. Feature gaps mentioned more than once
5. Any stage or deal profile that correlates with loss (deal age, company size, etc.)
Format as a clear summary for a VP of Sales.
This replaces the quarterly win/loss review that takes a consultant two weeks to produce. It runs automatically every month and covers 100% of closed deals, not a 15% sample.
Handling missing transcript data
Not every deal has Gong calls. Some deals close via email only. Some calls aren’t recorded. Handle these gracefully.
Add an IF node after the transcript pull: if no transcripts are found, skip the transcript section and run Claude analysis on CRM and email data only. Set confidence to “Low” in the output so you know the analysis has less data to work from.
For email-only deals, you can add an email pull from HubSpot’s engagement timeline and include the email subjects and response rates in the Claude prompt as a partial substitute for transcript data.
What patterns to look for first
Once you have 30+ deals in your database, these are the highest-value queries:
Lost deals by stage decided: if 60% of your losses are decided in Evaluation (not Discovery), you have a demo or proof-of-concept problem, not a qualification problem. That’s a different fix.
Feature gaps by deal size: large deals lost due to feature X are a roadmap conversation. Small deals lost due to the same feature might just be wrong-ICP deals you shouldn’t have pursued.
Competitor win rates by rep: if one rep beats Competitor A 70% of the time and another beats them 30% of the time, the high-performer has something specific in their approach. Record what they say on calls and make it training material.
Price sensitivity vs. deal size: if you’re hearing “too expensive” on deals under $20K but not on deals over $50K, you may have a packaging problem, not a pricing problem.
The manual version of this analysis costs 10-15 hours of ops time per month for a team closing 20-30 deals. The automated version runs continuously with no ongoing time investment, covers every deal, and builds a queryable database that compounds in value every quarter.
Win/loss analysis has always been worth doing. Now it’s worth doing automatically.
For a deeper look at how AI reads and interprets call transcripts, see the Gong to HubSpot AI integration guide. For the deal risk alerts that catch at-risk deals before they reach the loss column, see AI deal risk detection.
Related reading: How to Detect Dying Deals Before Your Rep Realizes - How to Build an AI Sales Forecast That’s Actually Accurate - How to Automate Your Sales QBR With AI
Want to get this running in your sales org? Talk to us or see what we build.