Conversion Rate Optimization (CRO) & A/B Testing
On this page
- Turning Existing Traffic into More Signups & Revenue
- The 4 Friction Points to Audit First
- Prioritizing Experiments with PXL / ICE Scoring
- Sample Size Math & Stopping Rules
- Detecting Sample Ratio Mismatch (SRM)
- Reading Qualitative Drop-Off Signals & Funnel SQL
- Guardrail Metrics & Experiment Specs
- Evaluating Post-Test Results with a Two-Proportion Z-Test
- Segmenting Results to Catch Simpson's Paradox
- Debugging in Production: How CRO Breaks
- Practice
Turning Existing Traffic into More Signups & Revenue#
Doubling your search or social traffic can take 6 to 12 months. Lifting a key landing page's conversion rate from 2.0% to 3.2% produces 60% more conversions from the exact same traffic starting this week, and improves the payback period of every acquisition channel you run.
AI helps CRO in two places: surfacing friction across qualitative feedback (exit surveys, chat logs, usability notes) and drafting bold structural hypotheses to test, while statistics and SQL decide which changes actually ship.
The 4 Friction Points to Audit First#
Before touching button colors or micro-tweaks, audit the four highest-impact bottlenecks on your page:
- 5-Second Clarity: Can a cold visitor tell what the product does, who it is for, and what clicking the button gives them?
- Form Friction: Every required field drops completion rate. Defer optional fields (company size, role, phone number) until after signup.
- Speed & Layout Stability: Slow First Contentful Paint, uncached large fonts, or layout shifts when images/scripts load hurt both SEO and conversion.
- Trust at the Point of Action: Place concrete proof (live preview, sample output, privacy guarantee, or "free, no account needed") right next to the primary CTA.
Prioritizing Experiments with PXL / ICE Scoring#
Do not test whichever idea someone mentioned last in Slack. Score candidate experiments on Impact (above the fold, high-traffic page, backed by VoC data), Confidence, and Ease so high-leverage structural tests run before button tweaks:
| Hypothesis | Traffic Share | Backed by Data? | Effort | Priority |
|---|---|---|---|---|
| Add interactive tool preview above the fold | 100% | Yes (exit poll #1) | Medium | High |
| Remove phone number from signup form | 40% | Yes (drop-off step 2) | Low | High |
| Change CTA button from blue to green | 100% | No | Low | Skip |
Sample Size Math & Stopping Rules#
The most common failure in AI-assisted CRO is spinning up 8 variants and declaring a winner as soon as one hits p < 0.05 after 90 visitors ("peeking"). Random noise regularly crosses p < 0.05 early in a test. Always calculate your required sample size and expected runtime in days before launching:
import math
def sample_size_per_variant(baseline_cr: float, relative_lift: float) -> int:
'''Approximate 95% confidence (alpha=0.05), 80% power sample size per variant.'''
p1 = baseline_cr
p2 = baseline_cr * (1.0 + relative_lift)
p_bar = (p1 + p2) / 2.0
z_alpha = 1.96
z_beta = 0.84
numerator = (
z_alpha * math.sqrt(2.0 * p_bar * (1.0 - p_bar))
+ z_beta * math.sqrt(p1 * (1.0 - p1) + p2 * (1.0 - p2))
) ** 2
return math.ceil(numerator / ((p2 - p1) ** 2))
daily_visitors = 400
for lift in (0.10, 0.25, 0.50):
n = sample_size_per_variant(0.03, lift)
days = math.ceil((n * 2) / daily_visitors)
print(f"Baseline 3.0%, +{int(lift*100)}% lift -> {n:,}/variant ({days} days at {daily_visitors}/day)")
Output:
Baseline 3.0%, +10% lift -> 54,487/variant (273 days at 400/day)
Baseline 3.0%, +25% lift -> 9,151/variant (46 days at 400/day)
Baseline 3.0%, +50% lift -> 2,487/variant (13 days at 400/day)
Look at those numbers. At 400 visitors/day, detecting a +10% lift takes 273 days (unusable). On lower-traffic sites, skip micro-tests and test bold structural changes aimed at +35% to +50% lift, paired with 5-user usability sessions.
Detecting Sample Ratio Mismatch (SRM)#
If your 50/50 split sends 5,400 users to Control and 4,600 to Variant, your randomization, bot filter, or redirect is broken. Never trust conversion results when SRM is present; compute the chi-square statistic first:
def check_srm(control_n: int, variant_n: int, expected_ratio: float = 0.5) -> dict:
'''Flag Sample Ratio Mismatch using a 1-df chi-square test (p < 0.001 threshold = 10.83).'''
total = control_n + variant_n
exp_c = total * expected_ratio
exp_v = total * (1.0 - expected_ratio)
chi2 = ((control_n - exp_c) ** 2) / exp_c + ((variant_n - exp_v) ** 2) / exp_v
return {"total": total, "chi2": round(chi2, 2), "srm_broken": chi2 > 10.83}
print("Balanced (5030 vs 4970):", check_srm(5030, 4970))
print("Broken (5400 vs 4600):", check_srm(5400, 4600))
Output:
Balanced (5030 vs 4970): {'total': 10000, 'chi2': 0.36, 'srm_broken': False}
Broken (5400 vs 4600): {'total': 10000, 'chi2': 64.0, 'srm_broken': True}
Reading Qualitative Drop-Off Signals & Funnel SQL#
Quantitative numbers tell you where visitors leave, while qualitative feedback tells you why. Write one SQL funnel query over your event log before designing any test, and pair it with a 1-question exit poll ("What almost stopped you from trying this today?") categorized by an LLM into unclear_pricing, missing_feature, setup_too_long, and trust_concern:
SELECT
COUNT(DISTINCT CASE WHEN event = 'landing_view' THEN session_id END) AS landed,
COUNT(DISTINCT CASE WHEN event = 'tool_submit' THEN session_id END) AS tried_tool,
COUNT(DISTINCT CASE WHEN event = 'signup_done' THEN session_id END) AS signed_up
FROM web_events
WHERE created_at >= CURRENT_DATE - INTERVAL '14 days';
If 1,000 users land, 420 try the tool, and only 12 sign up, focus your next experiment on the handoff between tool output and signup rather than rewriting the top hero. For example, adding a single "Save or export this result" prompt right below the tool output directly addresses the highest-intent moment in the session, whereas tweaking top-of-page copy touches users who already understand the tool.
When categorizing exit-poll replies with an LLM, map each category directly to an experiment type: unclear_pricing -> transparent tier calculator; setup_too_long -> one-click sample input; trust_concern -> local browser execution badge and privacy note.
Guardrail Metrics & Experiment Specs#
Every experiment needs a written 5-line spec before launch: Hypothesis, Primary Metric (e.g., 7-day activated signup), Sample Size & Runtime (always whole multiples of 7 days to avoid weekday/weekend bias), and Guardrail Metrics (page latency p95, refund rate, and mobile bounce rate). A variant that lifts signups +15% while doubling refund rate or adding 1.2s of client JS latency is a net loss.
Evaluating Post-Test Results with a Two-Proportion Z-Test#
Once your pre-registered runtime ends and check_srm() confirms randomization is clean, compute the z-score, two-sided p-value, and 95% confidence interval for the lift in Python before shipping:
import math
def ab_z_test(c_conv: int, c_n: int, v_conv: int, v_n: int) -> dict:
'''Two-proportion z-test and 95% CI for absolute lift.'''
p1 = c_conv / c_n
p2 = v_conv / v_n
p_pool = (c_conv + v_conv) / (c_n + v_n)
se_pool = math.sqrt(p_pool * (1.0 - p_pool) * (1.0 / c_n + 1.0 / v_n))
z = (p2 - p1) / se_pool if se_pool else 0.0
p_val = math.erfc(abs(z) / math.sqrt(2.0))
se_unpooled = math.sqrt((p1 * (1.0 - p1) / c_n) + (p2 * (1.0 - p2) / v_n))
diff = p2 - p1
ci_low = diff - 1.96 * se_unpooled
ci_high = diff + 1.96 * se_unpooled
return {
"control_cr": round(p1 * 100, 2),
"variant_cr": round(p2 * 100, 2),
"z_score": round(z, 2),
"p_value": round(p_val, 4),
"ci_95_abs_pct": (round(ci_low * 100, 2), round(ci_high * 100, 2)),
}
print(ab_z_test(90, 3000, 126, 3000))
Output:
{'control_cr': 3.0, 'variant_cr': 4.2, 'z_score': 2.5, 'p_value': 0.0124, 'ci_95_abs_pct': (0.26, 2.14)}
Segmenting Results to Catch Simpson's Paradox#
| Segment | Control CR | Variant CR | Relative Lift |
|---|---|---|---|
Desktop (>= 1024px) |
3.4% (68/2,000) | 4.8% (96/2,000) | +41.2% |
Mobile (390px) |
2.2% (22/1,000) | 3.0% (30/1,000) | +36.4% |
| Combined | 3.0% (90/3,000) | 4.2% (126/3,000) | +40.0% |
Always check desktop and mobile separately: if desktop lifts +45% while mobile drops -20% due to a pushed-down CTA, fix the mobile layout before shipping globally.
Debugging in Production: How CRO Breaks#
- Optimizing for clicks instead of downstream quality. Making a CTA say "Get Free Bonus" can spike form starts while crashing actual activation or paid conversion. Fix: Measure the activated step after signup as the primary metric.
- Multiple-testing inflation (A/B/C/D/E tests). Testing 5 variants simultaneously against Control at
alpha=0.05gives a~23%false-positive rate if uncorrected. Fix: Test 1 bold challenger against Control, or apply a Holm-Bonferroni correction. - Novelty effect & Simpson's paradox. Returning users sometimes click a shiny new layout once and never again, or a desktop gain hides a mobile crash when traffic mix shifts. Fix: Segment results by
new_vs_returninganddevice_type, and run at least 14 days. - Running overlapping site-wide tests without isolation. Changing the navbar, pricing, and hero simultaneously in three uncoordinated tests corrupts all three readouts.
Practice#
- Run
sample_size_per_variant()using your own site's daily traffic and baseline conversion rate to find the minimum relative lift you can detect in 14 or 28 days. - Run
check_srm()on your most recent experiment counts to confirm randomization is healthy. - Write a 5-line experiment spec (Hypothesis, Primary Metric, Guardrail Metric, Target Sample Size, Stop Date) for the largest drop-off step in your funnel.
Check your understanding
4 quick questions on this lesson. Get them all right and the lesson is marked complete.