The Fairness Factor in Marketing Attribution
1. The Hook
The quarterly review at Ujvi Candles was going smoothly—until it wasn't. The CEO was nodding along to the Markov Chain graphs we built in the last session. He loved seeing the "User Flow."
But the Affiliate Manager was fuming.
"This is nonsense," she said, pointing at the screen. "Markov says I'm worth $0 on half these orders because I'm usually in the middle of the chain. But when I get an influencer to post a link, the conversion rate on your precious Facebook ads doubles. I make everyone else look good, but I get no credit."
She wasn't wrong. She was describing Synergy.
Markov chains care about order. They care about who passed to whom. But marketing is often a Team Sport. Sometimes, it doesn't matter where you are in the chain, only that you were on the court.
To solve this, we need to leave the world of Graphs and enter the world of Cooperative Game Theory. We need the Shapley Value.
2. The Concept (The Basketball Team)
Here is what I tell my clients: Stop analyzing the pass. Start analyzing the score.
Please ensure the file is named exactly:
blog 7.1.png
Imagine a basketball duo: LeBron and Kyrie.
Where did the extra 50 points come from? That's the Synergy.
If we use "Last Touch" (who made the basket), we miss the synergy.
If we use "Shapley Value," we calculate the Marginal Contribution of each player.
We ask: "What is the difference in the score every time LeBron joins the game?"
- LeBron joins an empty court: +20.
- LeBron joins Kyrie: +70 (Difference between 10 and 80).
- Average Contribution: (20 + 70) / 2 = 45 points.
Shapley fairly distributes the synergy bonus. It rewards the "Glue Guys" who make everyone else better.
3. The Technical Solution (Python Logic)
"SQL gives up here," I told the Ujvi team. "To calculate Shapley, we have to simulate every possible combination of channels. That's exponential math ($2^n$). We need Python."
We use the itertools library to build "Coalitions" (Teams) and measure their win rate.
import itertools
# 1. The Players
channels = ['PPC', 'Social', 'Email']
# 2. Build All Possible Teams (Coalitions)
# Result: [], [PPC], [Social], [PPC, Social], [PPC, Email]...
coalitions = []
for i in range(len(channels) + 1):
coalitions.extend(itertools.combinations(channels, i))
# 3. Calculate Value for Each Team
# (In reality, we query the database for conversion rates of these specific combos)
team_values = {
('PPC',): 100, # PPC alone makes $100
('Social',): 50, # Social alone makes $50
('PPC', 'Social'): 300 # Together they make $300 (Synergy!)
}
# 4. Calculate Marginal Contribution
# What does Social add?
# Case 1: Adds to Empty Set (50 - 0) = 50
# Case 2: Adds to PPC Set (300 - 100) = 200
# Social's Shapley Value = Average(50, 200) = $125
4. The Real Data Scenario
We pulled Order #36725222 to demonstrate this. This order is a monster—27 touchpoints spanning Direct, Organic Social, SEO, and Affiliate.
Please ensure the file is named exactly:
blog 7.2.png
The "Team" on the Court:
- Direct (The constant presence)
- Organic Social (The engagement)
- SEO (The research)
- Affiliate (The influencer push)
The Journey:
The Analysis:
- Last Click Model: Gives 100% to Affiliate (it was the last non-direct touch).
- Markov Model: Sees Affiliate at the end and SEO in the middle. It gets confused by the 20 Direct visits cluttering the path.
- Shapley Value: It notices a pattern across all Ujvi orders.
Team {Direct, SEO} ➔ Conversion Rate: 2%
Team {Direct, SEO, Affiliate} ➔ Conversion Rate: 8%
The Shapley algorithm realizes that Affiliate is the power-up. Even if it didn't start the journey, its presence in the coalition quadruples the win rate.
The Verdict:
Shapley assigns Affiliate a huge chunk of the credit ($45.00), validation that the Affiliate Manager was right. She wasn't just "tagging along"; she was the catalyst.
5. The Reality Check (The Cost)
"This is amazing," the CEO said. "Run this for every single keyword we have."
"I can't," I said. "And here is the catch."
Shapley Value is computationally expensive.
- If you have 5 channels, that's $2^5 = 32$ coalitions to calculate. Easy.
- If you have 50 campaigns, that's $2^{50}$ coalitions. That is 1,125,899,906,842,624 calculations.
Our server would melt before it finished.
The Takeaway:
Shapley is the "Gold Standard" for fairness, but it doesn't scale well. Use it for high-level Channel attribution (Macro), but don't try to use it for Keyword-level attribution (Micro).
6. Next Steps & Interaction
We have now covered the most advanced "Current State" attribution models. But everything we have done so far is looking backward.
"What if," the CEO asked, "we could predict who will buy before they buy?"
That is Predictive Attribution, and we dive into Logistic Regression in Module 08.
Over to you: Have you ever tried to explain Game Theory to a CMO? Did their eyes glaze over? Share your war stories in the comments.