Funnel Analysis
Measuring how users move through ordered steps, finding where they drop off, and building funnels correctly in SQL.
Intermediate · about 5 hours · difficulty 3/5
Learn first: KPIs and Metric Design, Window Functions
A funnel measures what share of people complete a sequence of steps: visit, sign up, add to cart, check out. It is one of the most common analyst deliverables because it points directly at where to improve.
Building a funnel correctly
- Define each step as a specific event and decide whether steps must happen in order and within a window (e.g. purchase within 7 days of signup).
- Count users, not events, at each step, unless you specifically want event counts.
- Report both step conversion (step N / step N-1) and overall conversion (step N / step 1).
Funnels in SQL
A common pattern is one row per user with the first timestamp of each step:
SELECT user_id,
MIN(CASE WHEN event = 'signup' THEN ts END) AS signup_at,
MIN(CASE WHEN event = 'add_to_cart' THEN ts END) AS cart_at,
MIN(CASE WHEN event = 'purchase' THEN ts END) AS purchase_at
FROM events
GROUP BY user_id;
Then count users where each later timestamp is not null and greater than the previous one.
Segmenting for insight
The overall funnel says where people drop; segments say who. Break down by device, channel, country, new vs returning and app version. A drop confined to one segment is usually a bug or a specific experience problem.
Time to convert
Median time between steps often reveals friction that conversion rates hide.
Pitfall: mixing users who entered the funnel at different times so recent users look worse because they have not had time to convert. Use cohorts or fixed windows. You are ready to move on when you can build an ordered, windowed three-step funnel in SQL and segment it by device.
Key concepts
- Defining funnel steps
- Ordered and windowed funnels
- Step vs overall conversion
- Funnels in SQL
- Segmenting drop-off
- Time to convert
- Funnel reports in product tools
Mini project
Using the Google Analytics sample ecommerce dataset in BigQuery (or a Kaggle event log), build a view to product, add to cart, purchase funnel in SQL and segment it by device category.
Check yourself
Why can a funnel for users who signed up yesterday look much worse than last month's, and how do you fix the comparison?
Free resources
- Mode SQL Tutorial (Mode)
- Mixpanel docs: funnels (Mixpanel)