Repository navigation
Description
Summary
Show how long each funnel step takes, and let a funnel be broken down by one dimension so operators can see which segments convert.
Problem
A funnel today answers "how many people got from step 1 to step 2 and how many dropped". It does not answer two questions that decide whether the funnel is actionable:
- How long does the conversion take? A checkout that converts in four minutes and one that converts in four days are different problems, and the current step table cannot tell them apart. Operators end up guessing whether friction is in the form or in a later email.
- Who is failing? Drop-off is reported for the site as a whole. A step that converts at 60% overall can be 85% on desktop and 20% on mobile, and at the moment the only way to see that is to re-run the funnel once per segment.
Without those two, the funnel shows where the leak is but not what kind of leak it is.
Who Benefits
Dashboard users who read funnels (marketing, product, ecommerce operators), API users who pull funnel stats into their own reports, and self-hosted operators who cannot send the data to a BI tool.
Proposed Solution
The smallest useful version:
- Step timing. Add a median time since the previous step to each step of the funnel stats:
median_seconds_from_previous(null on the first step). Median, not mean, so a single returning visitor does not define the number. - Optional breakdown. Add an optional
breakdownparameter to the funnel stats endpoint, reusing the dimensions the dashboard already offers (country, device, source, entry page). When set, the response carries a top-N list of segments with their own per-step counts, plus anothersbucket so the response stays bounded. When unset, the response is exactly what it is today.
Both are additive to the JSON, no migration, no schema change.
Implementation notes, for reference only:
buildOrderedFunnelCTEsindatabase/store_analytics_goals.goalready keeps the previous step timestamp inp.tsand joins the next step on it, so the elapsed time is available at the point where step counts are computed.MEDIAN(...)is already used against DuckDB in the visible-time report, so no new engine capability is needed.- The step table in the funnels page already renders drop-off per step, so the timing column and the breakdown selector are additions to an existing surface.
User Workflow
- Open a funnel for a date range.
- Read the step table: visitors, drop-off, conversion and now the median seconds since the previous step.
- Pick a breakdown dimension.
- Get the same step table per top segment, with the remaining segments grouped, and compare where each one loses people.
- Export or read the same numbers through the API.
Success Criteria
- Each step with a predecessor shows a median time, and the value matches a manual calculation from the hits and events of a known session.
- First step shows no timing value rather than zero.
- Breakdown returns at most the requested number of segments plus an
othersbucket, and the bucketed counts add up to the unbroken-down totals. - Requests without a breakdown return the same payload shape as today, so existing API consumers and stored responses do not break.
- The funnel page renders both additions in every supported locale, and the breakdown selector is keyboard accessible.
Alternatives Considered
- A separate "timing" report: duplicates the funnel step picker and the ordered-session query, and splits one answer across two screens.
- Export raw hits and compute externally: loses the ordered-session logic that makes multi-step funnels correct, and demands a data stack from operators who chose a single binary on purpose.
- Run the funnel once per segment: works as a manual workaround, but it is exactly the workflow the breakdown replaces.
Constraints
- Cookieless tracking and the daily salt stay untouched. Nothing here needs identity across days, only the ordered events of a session.
- Single binary: the work stays inside the existing DuckDB queries, with no new backing service.
- Performance: the breakdown adds a group-by over the same session set. Keep top-N bounded and do not run the extra query when the parameter is absent.
- Accessibility: the breakdown control must work by keyboard and announce its state.
- API compatibility: new fields are additive and omitted when empty.
Release Notes
Funnels now show the median time between steps and can be broken down by country, device, source or entry page.
Activity
PascaleBeier commentedon Dec 2, 2026
Hey, how would you combine or implement this in regards of the new Journey on the Dashboard that was adedd in #515?
gnacho commentedon Dec 2, 2026
They answer different questions, so I would keep two surfaces and share the mechanics.
Journey is entry attribution over first hits: source, landing page, next path. It has no step chain, so timing only makes sense there for the first hop. The funnel is the ordered chain, and that is where step timing and segment comparison belong.
What I would share:
Breakdown rows keep the Journey row shape, one row per segment with its counts, plus an others bucket that Journey does not have today because it just applies a LIMIT. Same dimension names on both sides, so a segment chip can filter the dashboard without translation.
Funnel stats currently takes only from and to, so adding the parameter is also the moment to accept the filter and cohort params that entry-journeys already accepts. Then the funnel respects the dashboard selection instead of living in its own world.
The segment belongs in step_0, not in a second query. Entry source and entry page are already session level, and country or device come from the hit columns, so attaching the segment in the first CTE and carrying it through the join turns the breakdown into a GROUP BY over the same materialized chain. Build that path only when breakdown is present.
Median comes for free: step_i.ts minus step_{i-1}.ts is already in the chain, one more aggregate on the same rows. Others can be computed in Go as totals minus the sum of the top N segments, so the buckets add up by construction instead of by a second query.
Journey could reuse the same median through LEAD(timestamp) in its existing session window, so a 2-step funnel and the Journey card do not disagree on time, and a broken-down segment can open Journey as its attribution view.
Controls stay on the funnels page: a breakdown select and a median column in the step list. Folding a step picker into Journey duplicates the whole page.
One stats endpoint with an optional breakdown, or a separate call so the unbroken response stays a straight cache hit?