The Mathematical Crisis of Organic Search Attribution

Enterprise SEO programs routinely struggle with resource misallocation due to reliance on crude, heuristic attribution models. Traditional rules-based frameworks—such as First-Touch, Last-Touch, Linear, and Time-Decay—assign arbitrary weight to organic search interactions based on chronological position rather than marginal contribution. In a typical B2B or high-consideration eCommerce customer journey, an organic touchpoint rarely operates in isolation. A prospect might discover a domain via a programmatic informational glossary entry, return three weeks later through an unbranded technical comparison guide, re-engage via a branded query, and ultimately convert after clicking an organic sitelink.

Under Last-Touch attribution, the bottom-of-the-funnel (BOFU) navigational query captures 100% of the conversion value, systematically undervaluing top-of-the-funnel (TOFU) and middle-of-the-funnel (MOFU) content. Under First-Touch, the initial discovery asset is over-indexed, while the assets that bridged the consideration gap are zeroed out. To sustainably increase organic revenue, growth and analytics leaders must discard static heuristic heuristics in favor of algorithmic multi-touch attribution (MTA) grounded in graph theory and cooperative game theory. Implementing these rigorous models builds upon the foundational instrumentation outlined in Organic Multi-Touch Revenue Attribution and BOFU Pipeline Velocity Tracking, shifting attribution from subjective estimation to empirical, data-driven revenue allocation.

Markov Chain Attribution: State Transitions and Removal Effects

Markov chain attribution models customer journeys as a directed stochastic graph, where touchpoints represent states and user movements between touchpoints represent probabilistic transitions. Unlike static models, a discrete-time Markov chain accounts for path sequence, structural loopbacks, and abandonment.

Mathematical Framework and Matrix Representation

Let the journey state space be defined as $S = {s_1, s_2, dots, s_k, s_{conv}, s_{null}}$, where $s_1$ through $s_k$ are unique marketing touchpoints (e.g., Organic TOFU Informational, Organic MOFU Comparative, Paid Search, Email), $s_{conv}$ is the absorbing conversion state, and $s_{null}$ is the absorbing exit or non-conversion state.

The transition probability $P_{ij}$ from state $s_i$ to state $s_j$ is given by the maximum likelihood estimator:

P_{ij} = C_{ij} / sum_{k} C_{ik}

where $C_{ij}$ is the total number of observed transitions from state $s_i$ to state $s_j$ across all historical paths in the dataset. This constructs an $(m times m)$ transition probability matrix $mathbf{P}$. The transition matrix takes the canonical form of an absorbing Markov chain:

P = [ Q | R ]
[ 0 | I ]

where $mathbf{Q}$ is a $(k times k)$ matrix representing transitions between transient marketing states, $mathbf{R}$ is a $(k times 2)$ matrix of transitions from transient states to absorbing states ($s_{conv}$ and $s_{null}$), $mathbf{0}$ is a $(2 times k)$ zero matrix, and $mathbf{I}$ is a $(2 times 2)$ identity matrix.

Computing the Fundamental Matrix

The probability of reaching an absorbing state from any transient state is calculated using the fundamental matrix $mathbf{N}$:

N = (I - Q)^{-1} = sum_{k=0}^{infty} Q^k

The element $N_{ij}$ represents the expected number of visits to transient state $s_j$ given that the journey started in transient state $s_i$. The absorption probability matrix $mathbf{B}$ is computed as:

B = N times R

where $B_{i, conv}$ yields the exact probability that a user who touches marketing state $s_i$ will eventually reach the conversion state $s_{conv}$.

The Removal Effect Principle

To quantify the marginal value of an organic search touchpoint, we compute its Removal Effect. This measures the drop in overall network conversion probability when a specific state $s_i$ is completely removed from the graph, transforming it into an absorbing drop-off state.

Let $P(Conv)$ be the baseline conversion probability of the intact network from the initial entry state $s_{start}$ to $s_{conv}$. When state $s_i$ is removed, all transitions entering $s_i$ are redirected to $s_{null}$, producing a modified transition matrix $mathbf{P}^{( -s_i )}$. The new conversion probability is computed as $P(Conv setminus {s_i})$. The Removal Effect $R(s_i)$ is formally defined as:

R(s_i) = [P(Conv) - P(Conv setminus {s_i})] / P(Conv)

The attributed weight $W(s_i)$ of touchpoint $s_i$ across the overall organic system is then normalized across all evaluated channels:

W(s_i) = R(s_i) / sum_{j} R(s_j)

This relative weight is multiplied by the total conversion revenue to determine the precise dollar contribution of that channel state.

Shapley Value Formulation via Cooperative Game Theory

While Markov chains leverage graph topologies and state transitions, the Shapley Value approach roots touchpoint valuation in axiomatic game theory. Developed by Lloyd Shapley in 1953, this methodology evaluates how to equitably allocate total payoffs to players in a coalition game based on their marginal contributions across all possible subsets of players.

Axiomatic Foundations

In an attribution context, the “players” are marketing touchpoints $N = {1, 2, dots, n}$, the “grand coalition” is the entire marketing mix, and the characteristic function $v(S)$ represents the total revenue or conversions generated by any subset (coalition) $S subseteq N$. An equitable attribution framework must satisfy four fundamental axioms:

  • Efficiency: The sum of the values allocated to all channels equals the total payoff of the grand coalition: $sum_{i in N} phi_i(v) = v(N)$.
  • Symmetry: If two touchpoints $i$ and $j$ contribute identically to every coalition ($v(S cup {i}) = v(S cup {j})$ for all $S subseteq N setminus {i, j}$), their attributed revenue must be equal: $phi_i(v) = phi_j(v)$.
  • Dummy Player (Nullity): If touchpoint $i$ contributes nothing to any coalition ($v(S cup {i}) = v(S)$ for all $S subseteq N setminus {i}$), its attributed value is zero: $phi_i(v) = 0$.
  • Additivity: If journeys contain distinct conversion types (e.g., micro-conversions vs. closed-won pipeline), the joint attribution equals the sum of the individual valuations: $phi_i(u + v) = phi_i(u) + phi_i(v)$.

The Algorithmic Formula

The Shapley Value $phi_i(v)$ allocated to touchpoint $i$ is calculated as:

phi_i(v) = sum_{S subseteq N setminus {i}} [|S|! times (|N| - |S| - 1)! / |N|!] times [v(S cup {i}) - v(S)]

Here, $|S|$ represents the number of channels in subset $S$, $|N|$ is the total number of channels, and $v(S cup {i}) – v(S)$ is the marginal contribution of channel $i$ when introduced to coalition $S$. The weighting term accounts for every permutation in which coalition $S$ could be formed.

Tractable Approximation: Monte Carlo Sampling

A primary limitation of exact Shapley computation is its exponential time complexity, $O(2^{|N|})$. If an enterprise decomposes organic touchpoints granularly (e.g., 20 distinct content clusters, device types, or query intents), the model requires evaluating $2^{20} = 1,048,576$ coalitions. To handle this at scale, data engineering pipelines implement a randomized Monte Carlo sampling approximation:

hat{phi}_i(v) = (1 / M) sum_{m=1}^{M} [v(S_m cup {i}) - v(S_m)]

where $M$ is the number of randomly sampled permutations of player orderings, and $S_m$ is the set of channels preceding channel $i$ in permutation $m$. Convergence guarantees via Chebyshev’s inequality ensure high attribution accuracy with manageable computational overhead when $M ge 10,000$.

Comparative Architectural Matrix: Markov Chains vs. Shapley Values

Choosing the correct algorithmic framework requires balancing the structural nuances of organic search user behavior against computational and operational constraints.

Evaluation Dimension First-Order Markov Chain Higher-Order Markov Chain Shapley Value (Cooperative Game)
Path Sequence Sensitivity Low (Memoryless / Markov Property) High (Tracks history of $k$ states) None (Order-agnostic coalition sets)
Time & Computation Complexity $O(k^2)$ matrix operations (Extremely fast) $O(k^m)$ where $m$ is order depth $O(2^N)$ exact; $O(M cdot N)$ via Monte Carlo
Handling of Duplicate Touchpoints Implicit via self-loops ($P_{ii}$) Explicit via sequenced sub-paths Flattens to binary occurrence ($i in S$)
Handling of Non-Converting Paths Native via $s_{null}$ absorbing state Native via $s_{null}$ absorbing state Requires synthetic definition of $v(S)$ base rate
Optimal Organic Search Use Case Funnel drop-off and leak detection Complex multi-session path dependency High-level cross-channel budget equilibrium

Data Pipeline Engineering for Organic Path Disaggregation

To generate reliable inputs for Markov or Shapley models, organic search traffic cannot be treated as a monolithic channel. “Organic Search” must be programmatically decomposed into distinct functional clusters based on intent, URL taxonomy, and query classification.

Session Stitching and Identity Resolution

Data pipelines executing in systems like Google BigQuery or Snowflake aggregate event-level clickstream tables into session-stitched path arrays. First-party cookies, persistent authenticated customer IDs (`user_id`), and synthetic browser/device fingerprints are resolved into unified directed paths.

-- BigQuery SQL: Window Aggregation of Sequenced Path Touchpoints
WITH ordered_events AS (
    SELECT
        user_pseudo_id,
        session_id,
        event_timestamp,
        CASE
            WHEN channel = 'Organic Search' AND REGEXP_CONTAINS(landing_page, r'/blog/|/resources/') THEN 'SEO_TOFU_Informational'
            WHEN channel = 'Organic Search' AND REGEXP_CONTAINS(landing_page, r'/compare/|/vs/|/alternatives/') THEN 'SEO_MOFU_Commercial'
            WHEN channel = 'Organic Search' AND REGEXP_CONTAINS(landing_page, r'/pricing/|/product/|/integrations/') THEN 'SEO_BOFU_Transactional'
            WHEN channel = 'Organic Search' AND query_type = 'Branded' THEN 'SEO_Brand_Navigational'
            ELSE channel
        END AS granular_touchpoint,
        ecommerce.purchase_revenue AS revenue,
        event_name
    FROM `enterprise_data_warehouse.web_analytics_events`
    WHERE _PARTITIONDATE >= DATE_SUB(CURRENT_DATE(), INTERVAL 90 DAY)
),
aggregated_paths AS (
    SELECT
        user_pseudo_id,
        STRING_AGG(granular_touchpoint, ' > ' ORDER BY event_timestamp ASC) AS journey_path,
        MAX(CASE WHEN event_name = 'purchase' THEN 1 ELSE 0 END) AS conversion_flag,
        COALESCE(SUM(revenue), 0.0) AS total_revenue
    FROM ordered_events
    GROUP BY user_pseudo_id
)
SELECT * FROM aggregated_paths;

Python Execution: Markov Removal Effects

Once path sequences are extracted, the transition probability matrix is derived using Python. The following production-grade script models state transitions and applies the removal effect algorithm across decomposed organic touchpoints:

import numpy as np
import pandas as pd
from collections import defaultdict

def compute_markov_attribution(paths_df, path_col='journey_path', conv_col='conversion_flag', rev_col='total_revenue'):
    transitions = defaultdict(int)
    state_counts = defaultdict(int)
    states = set()

    for _, row in paths_df.iterrows():
        path = row[path_col].split(' > ')
        converted = row[conv_col] == 1
        
        # Add (Start) prefix
        full_path = ['(Start)'] + path
        if converted:
            full_path.append('(Conversion)')
        else:
            full_path.append('(Null)')
            
        for i in range(len(full_path) - 1):
            src, dst = full_path[i], full_path[i+1]
            transitions[(src, dst)] += 1
            state_counts[src] += 1
            states.update([src, dst])

    # Build Transition Matrix
    states = sorted(list(states))
    state_to_idx = {s: i for i, s in enumerate(states)}
    n_states = len(states)
    trans_matrix = np.zeros((n_states, n_states))

    for (src, dst), count in transitions.items():
        trans_matrix[state_to_idx[src], state_to_idx[dst]] = count / state_counts[src]

    # Convert to pure absorbing transition probabilities for (Conversion) and (Null)
    trans_matrix[state_to_idx['(Conversion)'], state_to_idx['(Conversion)']] = 1.0
    trans_matrix[state_to_idx['(Null)'], state_to_idx['(Null)']] = 1.0

    def calc_conversion_prob(P):
        # Using the standard transient-absorbing partition
        transient_states = [s for s in states if s not in ['(Conversion)', '(Null)']]
        t_indices = [state_to_idx[s] for s in transient_states]
        conv_idx = state_to_idx['(Conversion)']
        
        Q = P[np.ix_(t_indices, t_indices)]
        R = P[np.ix_(t_indices, [conv_idx])]
        
        I = np.identity(len(transient_states))
        # Fundamental Matrix N = (I - Q)^-1
        try:
            N = np.linalg.inv(I - Q)
            B = np.matmul(N, R)
            start_t_idx = transient_states.index('(Start)')
            return B[start_t_idx, 0]
        except np.linalg.LinAlgError:
            return 0.0

    baseline_conv_prob = calc_conversion_prob(trans_matrix)
    removal_effects = {}
    
    transient_marketing_states = [s for s in states if s not in ['(Start)', '(Conversion)', '(Null)']]

    for state in transient_marketing_states:
        P_removed = np.copy(trans_matrix)
        target_idx = state_to_idx[state]
        null_idx = state_to_idx['(Null)']
        
        # Redirect all inputs to target_idx into (Null)
        for i in range(n_states):
            if P_removed[i, target_idx] > 0:
                P_removed[i, null_idx] += P_removed[i, target_idx]
                P_removed[i, target_idx] = 0.0
                
        conv_prob_without_state = calc_conversion_prob(P_removed)
        removal_effect = max(0, (baseline_conv_prob - conv_prob_without_state) / baseline_conv_prob)
        removal_effects[state] = removal_effect

    total_effect = sum(removal_effects.values())
    total_rev = paths_df[rev_col].sum()
    
    attribution_results = {
        state: {
            'Removal_Effect': re,
            'Attribution_Weight': re / total_effect if total_effect > 0 else 0,
            'Attributed_Revenue': (re / total_effect if total_effect > 0 else 0) * total_rev
        }
        for state, re in removal_effects.items()
    }

    return pd.DataFrame.from_dict(attribution_results, orient='index')

Translating Algorithmic Outputs into Organic Budget Reallocation

Deploying advanced attribution is only useful if the mathematical outputs directly inform capital deployment. Once algorithmic modeling isolates the real marginal value of organic touchpoints, SEO teams routinely uncover massive valuation discrepancies compared to traditional models.

Correcting for the MOFU Gap

In almost every multi-touch enterprise journey, non-branded comparison and category-level keywords (MOFU Commercial) exhibit the highest Removal Effect in Markov models, yet receive less than 10% of revenue credit under Last-Touch systems. Because users rarely convert on a single comparison piece, heuristic models treat them as peripheral assists.

However, when the Markov Transition Matrix demonstrates that the probability of absorbing into $s_{null}$ jumps by 64% when SEO_MOFU_Commercial is removed, the Removal Effect algorithm re-indexes value to those comparison pages. To effectively increase organic revenue, strategic capital must flow away from over-saturated brand optimization and uninformative high-funnel keywords directly into the programmatic creation of middle-funnel evaluation hubs and product alternative architectures.

Shapley-Informed Bid and Budget Calibration

When running concurrent Google Ads and Organic Search programs, paid media teams frequently bid on terms where an organic listing already maintains top rank, claiming high conversion numbers. Shapley Value analysis provides the antidote: by measuring the marginal gain $v(S cup {text{Organic}}) – v(S)$ in the presence and absence of paid search, models often demonstrate that Paid Search acts as a redundant player in coalitions that contain SEO_Brand_Navigational.

Marketing teams leverage these findings to safely reduce paid brand bidding budgets, reallocating those savings toward technical SEO engineering, digital PR link equity acquisition, and custom interactive assets for informational paths that exhibit the highest empirical coalitional weight. The result is a mathematically optimized organic acquisition engine, fully accounted for by graph and game theory, that systematically drives compounding, incremental revenue.

Related Guides in This Series

In-Depth Sub-Topics & Exploration