Architect an A/B test for paid-ad signup flows

Tests pre-auth bucketing and funnel attribution. Hash a stable anonymous ID for fast assignment; stream events via Kafka into hourly aggregates; run t-tests on signup rates. Red flag: assigning after signup starts or DB lookups per assignment.
What's really being asked
This question tests whether you can design a controlled experiment that spans the boundary between anonymous traffic and authenticated conversion. The interviewer cares about three specific risks: assignment before identity exists, attribution across the signup funnel, and statistical validity at scale. You must show you understand how to bucket users without a database lookup, how to pipe events from a client SDK through a stream processor into queryable aggregates, and how to guard against experiment overlap and selection bias.
The full answer
A good answer hits four things in order. First, assignment at the ad landing page using a deterministic hash of a stable anonymous identifier plus the experiment identifier, producing a bucket number modulo one hundred that maps to variant ranges like zero to forty-nine versus fifty to ninety-nine. This must happen in under one millisecond with no database lookup, using MurmurHash3 or SHA-256, and the variant must be stored in a cookie or device token so it persists through the session. Second, event collection via a client SDK that intercepts the assignment event and every subsequent signup step, batches payloads every five seconds or on page unload, and sends them to an ingestion API backed by Kafka. Third, metric aggregation using a stream processor such as Flink to pre-aggregate counts and sums per hour per variant, storing the results in ClickHouse as tuples of experiment identifier, variant, metric name, bucket hour, value, and user count. Fourth, statistical analysis using two-sample t-tests on signup-rate differences to compute p-values and confidence intervals, plus guardrails like mutual exclusion layers so overlapping experiments on the same surface do not collide, and a small permanent holdout group to measure cumulative lift.
The mistakes people make
Common wrong answers include proposing to assign the variant only after the user begins signup, which severs attribution from the paid ad click and destroys the experiment; suggesting a centralized database to store per-user variant state, which adds latency and cannot scale to millions of assignments per second; ignoring mutual exclusion so users in one signup flow experiment are simultaneously in another, corrupting both metrics; and using simple modulo on user identifier alone without salting by experiment identifier, which forces the same users into the same bucket across every test and introduces dangerous correlation.
What usually comes next
Interviewers often follow up by asking how you would handle cross-device sessions where a user clicks an ad on mobile but converts on desktop; how you would ramp traffic from ten percent to fifty percent without breaking user consistency; how you would detect and mitigate sample ratio mismatch where the hash does not yield a true fifty-fifty split; or how you would compute the required sample size and experiment duration before launch.
A concrete example
Imagine a paid Instagram campaign driving traffic to a new signup flow. When the user taps the ad, the landing page hashes the device advertising identifier plus the experiment identifier, gets bucket sixty-three, and serves variant B. The JavaScript SDK immediately logs an assignment event with the anonymous identifier, experiment identifier, and variant. As the user fills out the form, each step fires an event. On successful signup, a conversion event is fired. All events batch to the API, stream through Kafka, and land in Flink which counts unique converting users per variant per hour. After one week, variant B shows a twelve percent relative lift in signups with a p-value below zero point zero five and a ninety-five percent confidence interval that excludes zero, so the team rolls it out to one hundred percent traffic.
Interview question
When bucketing anonymous paid-ad traffic for a signup-flow A/B test, which approach best satisfies speed, scale, and isolation requirements?
- a.Use a centralized Redis cache to store per-user variant assignments, retrieved on every page load to guarantee consistency across devices.
- b.Assign after the user submits the first signup form, then store the variant in a user database row to ensure authenticated attribution.
- c.Compute a deterministic hash of the anonymous ID salted with the experiment ID at the landing page, store the variant in a cookie, and skip database lookups entirely.Correct
- d.Apply modulo 100 directly to the raw user identifier without salting, assigning the same bucket to the same user across all experiments.
Why? this is the answer
Deterministic hashing with experiment salting at the landing page eliminates database latency and prevents cross-experiment correlation, while persisting the variant in a cookie maintains session consistency. Option B is tempting because database storage feels reliable, but delaying assignment until after signup starts severs attribution from the paid ad click and invalidates the experiment.
Just read this? Test yourself on what you have been reading.
Read the original → techinterview.org
- #ab-testing
- #system-design
- #growth-engineering
- #experimentation
- #data-pipeline
You just looked this up. Could you explain it out loud?
That is the part interviews actually test. Tezvyn takes questions like this one and gives you what the interviewer is really checking, the answer that lands, and the mistake that ends the conversation, in the four minutes before your next meeting.
The iPhone app is on the way
We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.
Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.
We are hiring for this. Open roles that interview on ab-testing — each one lists the topics its interview covers.
See open roles