Journey

Columns by default

Without data-orientation, steps sit side by side as columns and scroll sideways when they overflow. Each step is an <li> with a <header> and a <ul> of pages. A page is a <button aria-pressed>. Click it or press Enter or Space to pick it.

  1. Step 12,400 sessionsentered
  2. Step 2900 reached900 dropped off (50.0%)
  3. Step 3310 reached330 dropped off (51.6%)

Vertical

Steps stack downward, each indented a bit more. Each page takes a full row, which suits longer data: name, path (<small>), sessions and revenue (<data>). The line drops from the picked page and turns into the next step.

  1. Step 12,400 sessionsentered
  2. Step 2620 reached1,180 dropped off (65.6%)
  3. Step 3140 reached480 dropped off (77.4%)
    • Gift wrap/gift-wrap

Pages with outcomes

For a page like an upsell, add data-outcomes to the page's <li>. The name and path show once, followed by a <div> with one button per outcome (Declined / Accepted). Each outcome can be picked like a page, and the line joins at the page's row. The Accepted side shows the take rate as CVR.

  1. Step 1530 sessionsentered
  2. Step 2412 reached118 dropped off (22.3%)
    • Protection plan/upsell/protect
  3. Step 3108 reached3 dropped off (2.7%)

Picked path only

data-view="picked" hides the other pages and outcomes, leaving only the picked page in each step. The page sets this attribute itself, for example from a checkbox or an "All pages / Picked path" toggle.

  1. Step 12,400 sessionsentered
  2. Step 2620 reached1,180 dropped off (65.6%)

Fill later steps on pick

Each time a page is picked, the button fires tsunami:pick (bubbles) with detail.step (step index from 0) and detail.value (the button's value, or the page name). The page listens for it and loads the next steps in their place. Lines redraw on their own when steps or picks change.

  1. Step 11,000 sessionsentered

Pick a page in step 1

Change the colour

The picked pages and the lines use --journey-color (the accent by default), with --journey-ink for the text on top. Set them on one journey with a style attribute or a class. Use a variable such as var(--ok-fg) so the colour follows light and dark.

  1. Step 11,000 sessionsentered
  2. Step 2600 reached400 dropped off (40.0%)

API

journey.js works on every .journey on the page, including ones added later. No init call needed. The functions live on window.tsunami.journey.

Function / event Arguments / detail Description
pick(button) button: a page or outcome button in the journey Picks the page like a click: sets aria-pressed="true", clears picks in the same step and all later steps, fires tsunami:pick and redraws the lines
draw(journey) journey: element .journey Redraws the lines now (they normally redraw when the size, steps or picks change)
tsunami:pick { step, value } Fired by the button after a pick, and bubbles. step is the step index from 0. value is the button's value, or the text of its first <span> if none
Key Description
Tab Move to the next page (native; every page is focusable)
Enter, Space Pick the page (native button click)
↓, ↑ Move to the next or previous page in the step. In vertical mode it crosses into other steps
→, ← Move to the picked page in the next or previous step (or the step's first page if none is picked). Reversed in dir="rtl". Not used in vertical mode

Attributes

Attribute / element Values Description
.journey Outer box. Scrolls sideways when the steps overflow. Add role="group" and an aria-label to name it for screen readers
data-orientation vertical; none = columns (default) Stacks steps top to bottom, each indented 1.5rem more (up to 40%). Pages take a full row
data-view picked; none = all pages (default) Shows only the picked page or outcome in each step
--journey-color colour; default var(--accent) Fill of picked pages and colour of the lines. Set on .journey
--journey-ink colour; default var(--on-accent) Text colour on picked pages
> ol > li One step
li > header span, strong, small Step header: span step name (grey), strong session count, small drop-off count
li > ul > li One page in the step
button[aria-pressed] true, false A pickable page (or outcome). true = the picked page in this step (dark border). JS sets it on click. Add a value to send with tsunami:pick
button > span Page name, truncated with … when too long
button > small Page path (grey monospace). With a small in column mode, the numbers go under the name
button > data value Numbers: the first is sessions (right of the name), the second is revenue · RPV (grey)
li[data-outcomes] Present / absent A page with outcomes, such as an upsell: span name, small path, then a <div> of outcome buttons (Declined / Accepted + CVR). Lines join at this row
> svg Lines linking the picked pages. JS creates and draws it (aria-hidden). Do not write it yourself