What is a funnel analysis and how do you build one?
A funnel measures how many users progress through an ordered sequence of steps, such as view, add to cart, checkout and purchase. The conversion rate at each step shows where users drop off.
WITH steps AS (
SELECT user_id,
MAX(CASE WHEN event = 'view' THEN 1 ELSE 0 END) AS s1,
MAX(CASE WHEN event = 'add_cart' THEN 1 ELSE 0 END) AS s2,
MAX(CASE WHEN event = 'purchase' THEN 1 ELSE 0 END) AS s3
FROM events
GROUP BY user_id
)
SELECT SUM(s1) AS views, SUM(s2) AS carts, SUM(s3) AS purchases
FROM steps;
Key decisions: define the completion window, decide whether steps must occur in order, and choose whether to count sessions or users. Break results down by channel, device or cohort to find the worst segment. Segmenting the funnel usually yields more actionable insight than the overall rate.