Key Takeaways: Chapter 31 — Marketing Analytics and Campaign Analysis
The Core Mental Model
Marketing analytics is not about measuring everything. It is about measuring the right things — and then connecting those measurements into a coherent story about whether your marketing is working, why, and what to do differently.
Every marketing decision is ultimately a capital allocation decision: given a fixed budget, which investments produce the best returns? Python gives you the tools to answer that question with data rather than instinct.
Metrics That Matter
Customer Acquisition Cost (CAC) — Total marketing and sales spend divided by new customers acquired. Only meaningful in context of what those customers are worth.
Customer Lifetime Value (LTV) — The total revenue expected from a customer relationship: Average Order Value × Purchase Frequency × Customer Lifespan. Use gross-margin-adjusted LTV for investment decisions.
LTV:CAC ratio — The fundamental health metric for customer acquisition. Below 1:1 is existential. 3:1 to 5:1 is healthy for growth-stage businesses. Above 5:1 suggests underinvestment in growth.
ROAS — Revenue generated per dollar of ad spend. Meaningful only relative to your gross margin. Break-even ROAS = 1 / Gross Margin %.
CTR — Meaningful only when compared against channel-specific benchmarks. A 2% CTR means very different things in search versus display versus email.
Conversion rate — Always specify the denominator. "Conversion rate" from a landing page, from an email click, and from a free trial are three different measurements.
Attribution
- First-touch answers "how do customers discover us?" Gives full credit to the first interaction.
- Last-touch answers "what closes deals?" Gives full credit to the final interaction before conversion.
- Multi-touch attempts to distribute credit fairly across the whole journey, but requires more data infrastructure and involves modeling assumptions.
- No attribution model is objectively correct. The best approach is to use multiple models and look for channels that perform well across all of them.
A/B Testing Principles
- Determine sample size before you start. Use
calculate_required_sample_size(). Commit to running until you hit it. - Change one variable at a time. Multiple simultaneous changes produce uninterpretable results.
- Never peek. Looking at results before reaching target sample size inflates false positive rates.
- Statistical significance ≠ business significance. A 0.01% improvement may be real and still not worth implementing.
- Multiple testing requires correction. Running N tests simultaneously multiplies your expected false positive count by N. Apply Bonferroni correction or similar.
- Watch for novelty effects. Run tests long enough to see through the initial curiosity bump.
- Use chi-square for conversion rates; t-test for continuous metrics like average order value.
Funnel Analysis
- A raw conversion rate hides the structure of the problem. Break the funnel into stages.
- Focus optimization effort where absolute drop-off is largest, not where the rate looks worst. A 20% drop-off rate at a high-volume stage is more impactful to fix than a 40% drop-off at a low-volume stage.
- Always segment your funnel. Mobile vs. desktop, new vs. returning, channel by channel. Aggregate funnels hide the most actionable patterns.
- Revenue impact modeling lets you prioritize which funnel stage improvements to invest in first.
Channel Analysis
- CAC without LTV is meaningless. A high CAC on a high-LTV channel is fine. A low CAC on a low-LTV channel can still be a bad investment.
- LTV:CAC by channel is the key table. Build it. Update it quarterly.
- Efficiency ratio (revenue share / spend share) quickly identifies which channels punch above their weight.
- UTM parameters are foundational. Without them, you cannot attribute conversions to channels reliably. Tag everything.
Budget Optimization
- All marketing channels exhibit diminishing returns at sufficient scale.
- Budget allocation should be based on marginal return, not average return.
- Simple diminishing-returns models (power functions) are sufficient for most business contexts.
- The practical decision rule: systematically shift budget from channels with efficiency ratios below 1.0 toward channels above 1.0, in proportion to the efficiency gap.
The Most Common Mistakes
| Mistake | What Actually Happens | Better Approach |
|---|---|---|
| Aggregating across segments | Best channels/segments invisible | Always break down by tier, source, device |
| Peeking at A/B tests | False positive rate balloons | Commit to sample size in advance |
| Comparing CTR across channels | Apples and oranges | Use channel-specific benchmarks |
| Using ROAS without gross margin | Appear profitable while losing money | Calculate target ROAS from your margin first |
| Optimizing for volume, not quality | High-volume, low-LTV customers | Add LTV:CAC to your channel scorecard |
| Ignoring multiple testing | Declare "winners" that are random | Apply Bonferroni correction |
Key Python Tools
# Sample size calculation
from ab_test_analyzer import calculate_required_sample_size
# A/B test analysis
from ab_test_analyzer import analyze_conversion_ab_test, print_stakeholder_report
# Funnel analysis
from funnel_analyzer import FunnelAnalyzer
# Channel comparison
pandas.groupby().agg() # the workhorse for all channel metrics
scipy.stats.chi2_contingency() # conversion rate significance testing
scipy.stats.ttest_ind() # continuous metric significance testing
# Budget optimization
from scipy.optimize import minimize # constrained optimization
One Sentence Each
- CAC: What you paid to get one customer.
- LTV: What that customer is worth over their lifetime.
- ROAS: Are your ads generating more revenue than they cost?
- CTR: Are people engaging with what you put in front of them?
- A/B test: The only way to actually know whether a change helped.
- Funnel analysis: Find the leak before you pump in more water.
- Attribution: Decide which channel gets credit — knowing no model is perfect.