📋 KEY INSIGHTS
- Marketing analytics is one of the richest domains for applied data science: it combines causal inference (which campaign caused this conversion?), predictive modelling (which customers will churn?), optimisation (how should we allocate budget across channels?), and statistical testing (did this campaign work?). Each of these requires a different methodological toolkit, and confusing them ā using a predictive model to answer a causal question, or a causal method where a predictive one suffices ā is the most common error in marketing data science.
- Marketing attribution ā assigning credit for a conversion to the touchpoints along the customer journey ā is fundamentally a causal question: which touchpoints caused the conversion? Last-touch attribution (100% credit to the final touchpoint before conversion) and first-touch attribution (100% credit to the first touchpoint) are both wrong in general and produce systematically misleading channel ROI estimates. Data-driven attribution uses Shapley values from cooperative game theory to distribute credit fairly across touchpoints based on their marginal contribution.
- Customer Lifetime Value (CLV) modelling using the BG/NBD (Beta-Geometric/Negative Binomial Distribution) model or Pareto/NBD model separates the transaction process (how often does a customer transact, given they are alive?) from the dropout process (how likely is this customer to have churned?), producing probabilistic estimates of future transaction counts and CLV that are far more accurate than simple RFM scoring.
- Cohort analysis ā grouping customers by their first purchase period and tracking their behaviour over time ā is the single most revealing analytical technique in e-commerce and SaaS analytics. Cohort retention curves reveal whether product improvements are actually improving long-term retention; cohort revenue curves reveal whether CLV is increasing or decreasing over time; cohort comparison removes the survivorship bias that makes aggregate metrics misleading.
- Marketing mix modelling (MMM) is the econometric approach to measuring the aggregate impact of marketing spend across channels on business outcomes (revenue, conversions), using time-series regression to separate the effects of advertising from organic trends, seasonality, and macroeconomic factors. Robyn (Meta) and Meridian (Google) are the current open-source MMM frameworks that implement Bayesian MMM with regularisation on carryover effects (adstock) and saturation curves.
- The most underutilised technique in marketing analytics is holdout testing for campaign evaluation: withholding a random sample of customers from a campaign to serve as a pure control group. Without a holdout group, campaign performance metrics (conversion rate, revenue per user) are hopelessly confounded with selection bias (the customers who received the campaign were selected for it, not randomly assigned). Holdout testing is the randomised experiment that makes marketing attribution causal rather than correlational.
Marketing analytics generates some of the most interesting and well-resourced applied data science work in industry: the combination of large datasets, clear business metrics, and high stakes ā marketing spend in large organisations runs to hundreds of millions annually ā creates strong incentives to get the analysis right. It is also a domain plagued by methodological errors: attribution models that give misleading channel ROI signals, CLV models that conflate correlation with causation, campaign analyses that lack proper control groups, and optimisation models that maximise short-term conversion at the expense of long-term customer value. This guide covers the core methodological toolkit for marketing data science ā attribution modelling (last-touch vs Shapley-value-based data-driven attribution), customer lifetime value (BG/NBD model), cohort analysis, marketing mix modelling (MMM), and the statistical testing framework for rigorous campaign evaluation ā with connections to the causal inference and experimental design methods that make marketing analytics credible.
Marketing Attribution ā From Heuristics to Shapley Values
A customer who purchases a product has typically been exposed to multiple marketing touchpoints over days or weeks: a display ad, a search ad, an email, a retargeting ad, a social media post. Attribution is the problem of assigning credit for the conversion across these touchpoints. The correct answer is a causal one ā which touchpoints caused the conversion ā but causal attribution requires either randomised experiments (showing and withholding specific touchpoints randomly) or strong causal modelling assumptions. In practice, most marketing attribution uses heuristic rule-based methods or statistical approaches as approximations.
Rule-based attribution includes last-touch (100% credit to the final touchpoint), first-touch (100% credit to the first touchpoint), linear (equal credit to all touchpoints), time-decay (more credit to touchpoints closer to the conversion), and position-based U-shape (40% to first, 40% to last, 20% distributed to middle). All of these are arbitrary and produce systematically biased channel ROI estimates. Last-touch, for example, always attributes conversions to bottom-of-funnel channels (search, retargeting) that capture intent already created by upper-funnel channels (display, social), systematically overvaluing performance channels and undervaluing awareness channels.
Data-driven attribution (DDA) uses Shapley values from cooperative game theory ā the same SHAP values used for ML model interpretability ā to assign credit fairly. Each channel i’s Shapley attribution is the average marginal contribution of adding channel i across all possible orderings of the channel set: Ļ_i = Ī£_{S ā N\{i}} |S|!(|N|ā|S|ā1)!/|N|! Ć [v(SāŖ{i}) ā v(S)], where v(S) is the conversion rate of customers exposed to exactly the touchpoints in subset S. This is the unique attribution method satisfying efficiency (credits sum to total conversion value), symmetry (identical channels receive equal credit), dummy (non-contributing channels receive zero credit), and linearity ā the axioms of a fair credit allocation. Computing exact Shapley values requires 2^K evaluations for K channels; kernel SHAP approximations are used for K > 10 channels. The connection to our uplift modelling guide is direct: Shapley attribution measures average marginal contribution; uplift modelling measures counterfactual individual-level effect ā the two frameworks are complementary for channel evaluation and customer-level targeting respectively.
| Method | Type | Channel ROI Bias | Causal? | Data Required |
|---|---|---|---|---|
| Last-touch | Rule-based | Overvalues performance, undervalues awareness | No | Touchpoint sequence + conversion |
| First-touch | Rule-based | Overvalues acquisition, undervalues retention | No | Touchpoint sequence + conversion |
| Linear | Rule-based | Undifferentiated; ignores timing | No | Touchpoint sequence + conversion |
| Data-driven (Shapley) | Statistical | Minimal (Shapley fairness axioms) | Partially | Touchpoint subsets + conversion rates |
| Geo-holdout MMM | Causal (experiment) | None (randomised holdout) | Yes | Geo-level spend + conversion by region |
| Media Mix Modelling | Econometric | Depends on model assumptions | Partially | Time-series spend + revenue + controls |
Customer Lifetime Value ā BG/NBD Model and Probabilistic CLV
Customer Lifetime Value (CLV) is the present value of all future transactions a customer will make. Simple CLV estimates (average order value Ć average purchase frequency Ć expected customer lifetime) are dangerously misleading because they ignore the heterogeneity in customer behaviour and the censoring problem: we do not know whether a customer who has not purchased recently has permanently churned or is simply between purchases. The BG/NBD (Beta-Geometric/Negative Binomial Distribution) model addresses both by separately modelling transaction frequency and customer dropout.
The BG/NBD model makes four assumptions: (1) while alive, a customer makes purchases at a Poisson rate Ī»; (2) heterogeneity in Ī» across customers follows a Gamma(r, α) distribution; (3) each customer independently has a probability p of dropping out after each transaction (the geometric dropout process); (4) heterogeneity in p follows a Beta(a, b) distribution. Given each customer’s historical recency (time since last purchase), frequency (number of transactions), and tenure (time since first purchase), the model can be fit by maximum likelihood and then used to predict: the probability that a customer is still alive, the expected number of future transactions in the next T periods, and the CLV as the expected present value of future transactions. The Bayesian extension of BG/NBD (BG/NBD with hierarchical priors) provides full posterior distributions over future transaction counts, enabling calibrated uncertainty quantification of CLV estimates. The Python library lifetimes implements BG/NBD alongside the Pareto/NBD model (which uses the same framework but with a continuous geometric dropout).
CLV segmentation ā grouping customers into high-CLV, medium-CLV, and low-CLV segments based on predicted lifetime value ā drives resource allocation decisions: high-CLV customers receive premium customer success attention and personalised retention campaigns; low-CLV customers with negative predicted margin are deprioritised or actively churned. The connection to our uplift modelling guide is direct: CLV segmentation identifies who is worth retaining; uplift modelling identifies which retention treatment will actually work for each customer. The combined framework ā target customers with high CLV and positive predicted uplift from a retention intervention ā is the state-of-the-art in customer retention programme design and is described in our causal inference guide under heterogeneous treatment effects with heterogeneous outcomes.
Cohort Analysis, Marketing Mix Modelling and Budget Optimisation
Cohort analysis addresses survivorship bias in aggregate metrics: if a product’s daily active user retention rate appears to be improving over time, is this because the product is genuinely getting better for users, or because the early cohorts (who had lower retention) are ageing out of the denominator? Cohort analysis controls for this by comparing retention curves for cohorts acquired in the same period, revealing genuine product improvement signals. The standard cohort retention curve ā what fraction of customers acquired in month M are still active in month M+N, plotted for each acquisition cohort ā is the most revealing single chart in e-commerce analytics. A flattening of the curve at longer tenures (the “smile” shape) indicates a loyal retained core; a continuously declining curve indicates ongoing churn with no stable core. The survival analysis framework ā the Kaplan-Meier estimator for cohort retention, the Cox proportional hazards model for identifying features that predict retention ā is the statistical toolkit for cohort analysis beyond simple retention curves.
Marketing Mix Modelling (MMM) is the time-series regression approach to measuring the aggregate impact of marketing spend on revenue. The model regresses weekly or daily revenue on: paid media spend by channel (TV, digital display, search, social), organic factors (organic search, direct traffic), macroeconomic controls (GDP growth, consumer confidence), seasonality indicators (week-of-year, holidays), and price/promotion variables. The critical MMM components are adstock (carryover effect ā the diminishing impact of advertising spend in weeks after the campaign runs, modelled as a geometric decay) and saturation (the S-shaped or Hill function diminishing returns of spend on impact). Robyn (Meta’s open-source MMM) implements these with Nevergrad optimisation and cross-validation. Meridian (Google’s open-source MMM) uses Bayesian inference via Stan with informative priors on adstock and saturation parameters, producing posterior distributions over channel ROI that quantify the uncertainty in MMM estimates. Budget optimisation ā allocating total marketing budget across channels to maximise expected revenue ā is a constrained optimisation problem using the fitted MMM response curves, solved with scipy.optimize or the Bayesian posterior over response curves as described in our Monte Carlo simulation guide.
✦ SUMMARIZE THIS ARTICLE WITH AI
Uplift modelling for targeting which customers to treat ā the complement of attribution for channel evaluation ā is in our Uplift Modelling guide. Causal inference methods (DiD, holdout testing, RCTs) that make attribution causal are in our Causal Inference guide. A/B testing and statistical significance for campaign evaluation are in our A/B Testing guide. SHAP values for data-driven attribution credit are in our Model Interpretability guide. Survival analysis for cohort retention modelling (Kaplan-Meier, Cox) is in our Survival Analysis guide. Bayesian statistics for MMM prior specification and posterior inference is in our Bayesian Statistics guide.



