← Back to Glossary

Funnel analysis

Funnel analysis measures how users progress through an ordered sequence of steps toward a goal — such as viewing a product, adding it to cart, and checking out — identifying where the largest drop-offs occur.

Overview

A funnel is an ordered sequence of steps a user is expected to move through toward some goal: for example, "viewed product" -> "added to cart" -> "started checkout" -> "completed purchase." Funnel analysis measures, for a group of users, how many reach each step and, critically, the conversion rate between consecutive steps — which reveals exactly where the biggest drop-off happens, rather than just reporting an overall conversion rate from first to last step. This makes it a core technique in product and growth analytics for prioritizing where to invest in fixing friction.

Ordered versus unordered funnels

Most funnel definitions require steps to happen in order for a given user (and often within some time window), which distinguishes funnel analysis from simply counting how many users ever performed each event — a user who adds an item to their cart before viewing the product page (e.g., via a shared link) may or may not count, depending on the funnel's rules.

Computing a funnel in DuckDB

A common pattern uses conditional aggregation or window functions to find whether, and when, each user completed each step in order:

Copy code

WITH steps AS ( SELECT user_id, min(event_time) FILTER (WHERE event_name = 'viewed_product') AS t_view, min(event_time) FILTER (WHERE event_name = 'added_to_cart') AS t_cart, min(event_time) FILTER (WHERE event_name = 'completed_order') AS t_order FROM events GROUP BY ALL ) SELECT count(*) AS total_users, count(*) FILTER (WHERE t_cart IS NOT NULL AND t_cart > t_view) AS reached_cart, count(*) FILTER (WHERE t_order IS NOT NULL AND t_order > t_cart) AS reached_order FROM steps;

From there, step-to-step conversion rates are simple divisions, and QUALIFY or window functions can be layered in for more complex ordering or time-window constraints (e.g., "completed checkout within 24 hours of adding to cart").

Why it matters

Funnel analysis turns a single conversion-rate number into a diagnostic: instead of just knowing that 2% of visitors buy something, it shows whether the problem is that people don't add items to cart, or that they add items but abandon at checkout — two very different problems requiring very different fixes.

Related terms

FAQS

Funnel analysis measures progression through an ordered sequence of steps toward a single goal within one flow. Cohort analysis groups users by a shared starting point in time and tracks broader behavior or retention over subsequent periods. They're often used together, for instance analyzing signup-to-purchase funnel conversion separately for each signup cohort.

Typically yes — most funnel definitions require each step's timestamp to come after the previous step's, often within a defined time window, which is why funnel SQL usually compares timestamps between steps rather than just checking whether each event occurred at all.