Glossary

What a Sankey Diagram Shows That a Funnel Cannot

Taras Shynkarenko
Taras Shynkarenko
•Updated: •8 min read
What a Sankey Diagram Shows That a Funnel CannotWhat a Sankey Diagram Shows That a Funnel Cannot

TL;DR, Quick Answer

8 min read

A sankey diagram draws flow as bands whose width is proportional to quantity, with nodes for stages and links for the movement between them. The rule that separates it from every other chart is conservation: d3-sankey, the layout almost every implementation descends from, computes `node.value` as the sum of `link.value` for the node's incoming links, so width in equals width out unless you declare otherwise. That rule also sets the limits. d3-sankey handles directed flow "in an acyclic network", and real user journeys loop. Google's own documentation disagrees with itself here: Google Charts says Google Analytics uses sankeys for page-to-page traffic, while the GA4 help page calls Path exploration a tree graph.

What is a sankey diagram?

Every sankey diagram obeys one rule that no other chart enforces: the quantity entering a node equals the quantity leaving it, so band width is conserved from one end of the picture to the other. Google's chart documentation gives the plain definition, that a sankey diagram is "a visualization used to depict a flow from one set of values to another", where "the things being connected are called nodes and the connections are called links".

That is the whole grammar. Nodes are stages, categories or pages. Links are the movement between them. The width of each link is proportional to the number moving along it, and the height of each node is proportional to the total passing through it.

The name comes from Captain Sankey, who drew steam engine efficiency using arrows whose widths were proportional to heat loss. Energy accounting is why the conservation rule is baked in: heat that enters an engine has to go somewhere, and the diagram was built to show where.

What makes the conservation rule different from other charts?

A bar chart lets every bar be independent. A sankey does not.

The clearest statement of this lives in the API contract for d3-sankey, the layout that Google's own sankey code is derived from. Its documentation defines the node value as follows:

node.value - the node's value; this is the sum of link.value
             for the node's incoming links, or node.fixedValue
             if defined

Two consequences follow directly. First, link.width is proportional to link.value and node.y1 - node.y0 is proportional to node.value, so you cannot inflate one band without shrinking another. Second, if your data does not balance, the layout does not warn you. It recomputes the node from whatever links you supplied and draws a coherent picture of an incoherent dataset.

This is why drop-off has to be modelled explicitly. If 1,000 sessions enter a cart page and 600 continue to checkout, a sankey with one outgoing link of 600 will silently redraw the cart node as a 600-unit node. The 400 that left are not shown as a loss, they are shown as never having existed. You have to add an exit node carrying 400 for the picture to tell the truth.

The other structural constraint sits in the first line of the d3-sankey documentation: it visualises "the directed flow between nodes in an acyclic network". Acyclic means no loops. User journeys loop constantly.

A shopper checking out on a phone, the kind of branching path a sankey diagram traces from cart to purchase.

Same cart data, two pictures
One outgoing link only
  • Cart node redraws itself as 600 units
  • The 400 sessions that left are gone from the picture
  • Widths still balance, so nothing looks wrong
Outgoing link plus exit node
  • Cart node stays at 1,000 sessions
  • Checkout link carries 600, exit link carries 400
  • Widths balance and match what happened
A sankey renormalizes around whatever links you supply, so the same 1,000-session cart page looks healthy either way unless the exit link is drawn.

Where does a sankey help in analytics?

Where the question is about branching, and where the branches matter as much as the trunk.

A funnel answers one question well: how many survived each step, in a fixed order you defined in advance. A sankey answers a different one: where did everybody actually go. Four cases where that is the better question:

  • Traffic source to landing page to outcome. A funnel collapses this to a conversion rate per channel. A sankey shows that one channel concentrates on a single landing page while another spreads across twelve, which changes what you fix.
  • Multi-path checkouts. Guest checkout, account checkout and express payment are three branches, not three steps. A sankey keeps them separate through to the end.
  • Search to result to action. Query type on the left, result category in the middle, action on the right, with the no-action band drawn at full width instead of omitted.
  • Plan or category migration. Which plan did each upgrade come from, which did each downgrade go to, all in one picture.

The shared property is many-to-many movement. Google's documentation says the same: sankeys are best used for "a many-to-many mapping between two domains" or "multiple paths through a set of stages". Where the movement is one-to-one and ordered, a funnel analysis carries the same information in less ink.

Where does a sankey mislead?

In four specific ways, all of which come from the conservation rule meeting messy real data.

Loops get flattened into breadth. Because the layout requires an acyclic graph, a visitor who goes home, product, home, product produces two distinct home nodes at two distinct steps. The product page looks like two separate destinations and the same page appears twice in one picture. Nothing is wrong with the numbers. The shape suggests exploration where the reality is a person going back and forth.

Truncation breaks the arithmetic. Path reports cap how many nodes they show per step. GA4's path exploration shows the top 5 nodes by default, lets you expand to 20, and groups everything beyond that into an "Others" node. The moment a tail is folded into "Others" or dropped, the widths stop representing the population, and the widest band at step four is the widest among survivors rather than the widest overall.

Flowsery
Flowsery

Start Your 14-Day Free Trial

Real-time dashboard

Goal tracking

Cookie-free tracking

Exits are invisible unless you build them. This is the same failure as the cart example above, and it is the most common reason a sankey looks healthier than the business. Every stage needs an explicit exit link or the picture quietly renormalises around whoever continued. Cross-check the widths against your drop-off rate before showing the diagram to anyone.

Horizontal position is order, not time. Columns are steps. A gap of three seconds and a gap of three days occupy the same distance. A journey that looks smooth in a sankey can contain a two-day stall that the layout has no way to express.

Which analytics tools render one?

Fewer than the term's popularity suggests, and Google's documentation contradicts itself on this exact point.

ToolWhat it rendersWhat its own docs say
Google Analytics 4Path exploration"Explore your user journeys in a tree graph." Top 5 nodes per step by default, expandable to 20, with the remainder grouped into "Others"
Google ChartsSankey chart type"A sankey diagram is a visualization used to depict a flow from one set of values to another." Rendered as SVG or VML; the layout code "is derived from D3's sankey layout code"
MatomoUsers Flow, a paid plugin"Shows navigation paths for up to 10 interaction steps and more steps can be added optionally", with "over 100 pages" available per interaction step
PostHogUser paths insight"Each step along the path is a page that the user viewed, and the horizontal bars correspond to a user navigating from one page to another." The documentation does not use the word sankey
d3-sankeyThe layout itself"Sankey diagrams visualize the directed flow between nodes in an acyclic network." Defaults: nodeWidth 24, nodePadding 8, iterations 6

The contradiction is worth reading twice. The Google Charts sankey page uses Google Analytics as its example of the chart type in use, saying sankeys are how "Google Analytics uses sankeys to show how traffic flows from pages to other pages on your web site". The GA4 help page for path exploration describes the same feature as a tree graph. A tree and a sankey are not the same object: in a tree, every node has exactly one parent, so flows split but never rejoin. In a sankey, two sources can merge into one node. That difference decides whether the report can tell you that two channels converge on the same page.

Google Charts also carries its own warning on the page: "The sankey chart may be undergoing substantial revisions in future Google Charts releases."

An analyst pointing at data on a screen, the kind of check needed before trusting a sankey diagram's numbers.

How do you build one that does not lie?

Five rules, all of which are about the data rather than the drawing.

  1. Add exit nodes at every stage. If a stage has 1,000 in and 600 out, the third link is a 400-unit exit. Without it the diagram renormalises.
  2. Fix the unit before you start. Sessions and users produce different pictures, because one user contributes several sessions and a user-level diagram merges paths that a session-level diagram keeps apart. Decide which, label it, and never mix the two in one chart. The distinction is the same one behind pageviews, sessions and users.
  3. Group before you truncate. Collapse /product/* into one node deliberately rather than letting the tool drop the tail. A designed grouping keeps the arithmetic; a truncation destroys it.
  4. Cap the steps. Four or five columns is the readable limit. Beyond that the bands cross so heavily that no reader can trace a path, and the conservation property stops being visible even though it still holds.
  5. Rebuild from the raw sequence. The source data for a correct sankey is hit-level, ordered by identifier and timestamp, which is exactly the shape of clickstream data. Aggregated reports have already thrown away the ordering the chart needs.

A sankey built this way and a user flow report answer the same question, but only one of them shows you the size of what you lost at each step.

Frequently asked questions

What is the difference between a sankey diagram and a funnel chart?

A funnel assumes one ordered path and reports survival at each step. A sankey shows every path taken, including branches that rejoin, and scales each band to its volume. Use a funnel when the sequence is fixed and you defined it in advance. Use a sankey when the interesting part is where people diverged.

Is GA4's path exploration a sankey diagram?

Google's own documentation answers both ways. The GA4 help page calls path exploration a tree graph. The Google Charts sankey page cites Google Analytics as an example of sankeys showing how traffic flows between pages. The behavioural difference is that a tree cannot show two sources merging into one node.

Why does my sankey not add up?

Almost always because drop-off is not represented as a link. Layouts based on d3-sankey derive a node's value from the sum of its incoming links, so any population that leaves without an outgoing link is absorbed rather than displayed. Add an explicit exit node at every stage.

Can a sankey diagram show loops or return visits?

Not directly. d3-sankey is documented as a layout for acyclic networks. Tools work around this by treating each step as its own column, so a page visited twice appears as two nodes. The numbers stay correct and the shape overstates how many distinct destinations exist.

How many steps should a sankey show?

Four or five columns. Each additional column multiplies the number of crossing bands, and past that point readers cannot trace an individual path, which removes the only advantage the chart had over a table.

Does a sankey diagram need equal totals on the left and right?

Yes, if it is built correctly. Every unit entering the leftmost column has to arrive somewhere in the rightmost column, including in an exit or churn node. Unequal totals mean a population left the diagram without being accounted for.

Why is it called a sankey diagram?

The name comes from Captain Sankey, who used the diagram to chart steam engine efficiency. He drew arrows whose width was proportional to heat loss, and that is also where the conservation rule comes from: energy entering an engine has to go somewhere, and the diagram was built to show where.

Flowsery
Flowsery

Start Your 14-Day Free Trial

Real-time dashboard

Goal tracking

Cookie-free tracking

What is the difference between a sankey diagram and a tree graph?

In a tree graph, every node has exactly one parent, so paths split but never rejoin. In a sankey diagram, two sources can converge into the same node downstream. That distinction is exactly what is at stake in GA4's path exploration, which Google calls a tree graph even though the Google Charts sankey page cites Google Analytics as an example of a sankey.

What data do you need to build a sankey diagram?

Hit-level data, ordered by identifier and timestamp, the same shape as clickstream data. Aggregated reports have already thrown away that ordering, and a sankey needs it to place each user in the right node and link.

Can a sankey diagram show how long each step in a journey took?

No. Horizontal position in a sankey represents order, not elapsed time, so a three-second gap and a three-day gap between two steps take up the same distance on the chart. A journey that looks smooth in a sankey can hide a multi-day stall the diagram has no way to show.

Was This Article Helpful?

Let us know what you think!

See us more often in Google

One click marks Flowsery as a preferred source, so our articles sit higher in your Top Stories, AI Mode, and AI Overviews.

Before you go...

Flowsery

Flowsery

Revenue-first analytics for your website

Track every visitor, source, and conversion in real time. Simple, powerful, and cookie-free.

Real-time dashboard

Goal tracking

Cookie-free tracking

Related Glossary Terms

Related Articles