Ordered Store-to-Checkout Funnel by Platform from App Events
Last updated: November 29, 2026
Quick Overview
From an app events table, compute a strictly ordered session funnel (store view, add to cart, checkout start, order placed) per platform for one day, with step-to-step conversion rates.
DoorDash
November 29, 20260
0
0 solved
From an app events table, compute a strictly ordered session funnel (store view, add to cart, checkout start, order placed) per platform for one day, with step-to-step conversion rates.
DoorDash consumer DS interviews often start from a conversion question on the iOS, Android and web apps, and a funnel query is the first thing you would write when checkout conversion moves. The interviewer checks that steps must happen in order within a session and that you avoid inflating counts with repeated events.
What the Interviewer Expects
- Define the funnel at the session level and require each step to occur after the previous one
- Use the earliest qualifying timestamp for each step
- Use LEFT JOINs so sessions that drop out are still in the denominator
- Report both counts and step conversion, guarding against division by zero
- Mention how out-of-order events or clock skew affect the result
Key Topics to Cover
How to Approach This
- Clarify the schema and expected output format before writing queries.
- Use CTEs (WITH clauses) to break complex queries into readable steps.
- Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
- Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
- For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
- How would you change this to a user-level funnel within 24 hours instead of within a session?
- Checkout-to-order dropped 3 points on Android only. What would you query next?
- How would you handle a user who views store A, adds from store B, and checks out?
- How would you write this with window functions over a single scan for a very large event table?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice SQL ProblemsSample Answer
Clarify the Data
Assume app_events(session_id, user_id, platform, event_name, ts, event_date) where sessions are already defined by the client. Counting is per session. A step counts only if it occurs at or after th...
Approach
Build the funnel as a chain: for each session, the first store view; then the first add-to-cart at or after that; then the first checkout start after that; then the first order placed after that. Each...