# User flow analysis

User flow analysis maps the paths people take through your product (which events follow which), so you see where users go next and where they drop off.

Source: https://pug.sh/glossary/user-flow-analysis

User flow analysis maps the paths people take through your product (which events follow which), so you can see where users go next and where they drop off, often visualized as a Sankey diagram.

*User flow after page_view: 34% to search, 22% to add_to_cart, 12% to checkout_started, 32% to session_end*

A user-flow Sankey: branch width shows how many users take each path between events.

## How user flow analysis works

Starting from an event (or working backward into one), the analysis follows what users did next, and next after that, aggregating the most common paths. The result is usually a **Sankey diagram**: branching bands whose width reflects how many users took each path. Where a funnel tests a sequence you chose, a flow reveals the sequences users chose.

## Why it matters

Flows are exploratory. They surface the routes you didn’t plan for: a feature people reach by an unexpected path, a loop where users get stuck, or a common exit point right before a key action. That’s often where the next funnel or experiment comes from.

## Forward and backward

Looking **forward** from an event answers “where do people go after this?” Looking **backward** into an event answers “how do people get here?” Both are useful. The backward view is especially good for understanding the paths that lead to conversion or to churn.

## A worked example

You expect new users to go `signup` → `create_project`. A forward flow from `signup` instead shows the busiest path is `signup` → `view_pricing` → `exit`: a sizable branch detours to pricing and leaves, never reaching the product. No funnel would have caught it, because you’d never have drawn that step. The flow surfaced the question: now you build a funnel to size it and a change to test.

## How Pug does user flows

Pug’s [User flow](https://pug.sh/analytics) insight renders a Sankey of the paths users take between events: where they go next and where they drop. Combined with [autocapture](https://pug.sh/glossary/autocapture), you get rich paths without instrumenting every interaction, and a complementary [funnel](https://pug.sh/glossary/funnel-analysis) once you know which sequence to measure.

- [Funnel analysis](https://pug.sh/glossary/funnel-analysis)
- [Autocapture](https://pug.sh/glossary/autocapture)

## User flow analysis: common questions

### What is a Sankey diagram in analytics?

A Sankey diagram visualizes flows as branching bands whose width is proportional to volume. In analytics it shows how users move between events. Each band is a path, and you can see at a glance where most people go next and where they branch off.

### What’s the difference between a funnel and a user flow?

A funnel measures conversion across steps you define in advance. A user flow is exploratory: it shows the paths users take between events, including ones you didn’t expect, rather than testing a fixed sequence.

### How is user flow analysis used?

To discover real navigation paths, find where users drop off or loop, and spot unexpected routes to (or away from) a goal. It’s most useful before you know which funnel to build.
