roadmap icon indicating copy to clipboard operation
roadmap copied to clipboard

Show user flow in a sankey chart

Open adriaandotcom opened this issue 3 years ago • 0 comments

Let's say we have this data:

referrer.hostname referrer.path hostname path country
example.com /path1 example.com /path2 NL
example.com /path1 example.com /path2 UK
google.com /search example.com /path1 NL
google.com /search example.com /path1 NL
google.com /search example.com /path1 UK
duckduckgo.com /search example.com /path1 NL
(empty) (empty) example.com /path1 NL
(empty) (empty) example.com /path2 NL

Make it like this:

from (5) percentage to
google.com 40% (2/5) /path1 (4)
(direct) 20% (1/5)  
duckduckgo.com 20% (1/5)  
drop off 40% (2/5)  
     
google.com 20% (1/5) /path2 (1)

But then with multiple steps:

1. GA (dropoff & inject) 2. clean (only dropoff) 3. clean but boring
telegram-cloud-photo-size-4-5886651394323232386-x telegram-cloud-photo-size-4-5886651394323232385-y) telegram-cloud-photo-size-4-5886651394323232383-y

I would love to have both dropoff and inject. Like Google Analytics. But screenshot "2. clean (only dropoff)" looks the best.

Mixpanel looks beautiful:

Screenshot

This looks nice as well (in D3):

Screenshot

Data for live example
google.com,/landing1,10
duckduckgo.com,/landing1,1
duckduckgo.com,/landing1,5
google.com,/landing2,1
duckduckgo.com,/landing2,1
duckduckgo.com,/landing2,1
(direct),/landing1,2
others (50+),/landing1,5
others (50+),/landing2,4
/landing2,/path2,2
/landing1,/path2,4
/landing2,/path3,1
/landing1,/path4,3

This seems ideal for landing pages. Howeever, is doesn't work well when you map out all pages. Use the data below:

Data that should be circular
example.com,/path1,400
/path1,/path2,700
google.com,/path1,100
google.com,/path1,100
google.com,/path1,100
duckduckgo.com,/path1,100
(direct),/path1,100
(direct),/path2,100
/path2,path3,100
/path3,/path1,100

The above data example should show circular data from /page3 to /page1:

Screenshot

But it does not.

There are two alternatives that do support circular links:

  • https://github.com/tomshanley/d3-sankey-circular/
  • https://github.com/ricklupton/d3-sankey-diagram

adriaandotcom avatar Oct 12 '21 07:10 adriaandotcom