Guides · Google · ~10 min

How to see three-step paths in the navigation flow

Hover a page on the left of the flow and see where visitors who came from it went next.

GA4 only records pairs: "A went to B" and "B went to C". It does not know where people who came from A and saw B went afterwards. A small script sends the previous two pages with every page view as a nav_step event; seops uses it to draw A → B → C with real data.

Do first: How to connect Google Analytics 4

What opens in seops

  • 4 · Tracking › Traffic › Navigation › Flow: hover a page on the left and only that path lights up on the right
  • Your assistant (get_navigation) can read the most common three-step paths
  • No cookie; only sessionStorage, cleared when the tab closes

Steps

  1. Custom dimension 1: previous page

    In Analytics: Admin (gear) → Data display → Custom definitions → Create custom dimension. Dimension name Previous page. Scope Event. Event parameter prev_path. Save.

    prev_path
  2. Custom dimension 2: page before that

    Same screen, Create custom dimension again. Name Page before previous. Scope Event. Event parameter prev2_path. Save.

    prev2_path
  3. Add the script to the site

    It must run on every page after GA4. With Cloudflare Zaraz it sends through zaraz.track, otherwise through gtag. On WordPress paste it in the footer with a code-snippet plugin. On your own site, telling your coding agent "add the nav_step snippet from seops" is enough.

    <script>
    // seops · three-step navigation (Traffic › Navigation › Flow). Run on every page, after GA4.
    (function () {
      try {
        var S = sessionStorage, h = JSON.parse(S.getItem("nav_hist") || "[]"), c = location.pathname, r = "";
        try { var u = new URL(document.referrer); if (u.host === location.host) r = u.pathname; } catch (e) {}
        if (h[h.length - 1] === c) return; // reload
        if (r && r !== c) {
          var p = { prev_path: r.slice(0, 100), prev2_path: (h[h.length - 1] === r ? h[h.length - 2] || "(entry)" : "(unknown)").slice(0, 100) };
          if (window.zaraz && zaraz.track) zaraz.track("nav_step", p); else if (window.gtag) gtag("event", "nav_step", p);
        }
        S.setItem("nav_hist", JSON.stringify(r ? [r, c] : [c]));
      } catch (e) {}
    })();
    </script>
  4. Using Zaraz? Forward the event to GA4

    In Cloudflare: Zaraz → Tools → Google Analytics 4 → Actions → Create action. Trigger: Create trigger with rule {{ client.__zarazTrack }} Equals nav_step. Action type Event, event name nav_step. Add field twice: prev_path = {{ client.prev_path }}, prev2_path = {{ client.prev2_path }}. Save.

  5. Check

    Browse a few pages on your site. In GA4 → Reports → Realtime the nav_step event should appear. The flow in seops starts filling within a day; custom dimensions only cover data from the day they were created.

How to use it in seops

  • 4 · Tracking › Traffic › Navigation: pick a page, hover a page on the left of the flow
  • If no data arrives for a while, the Status line under the card says why

Questions

"Custom dimensions not defined"

The parameter names in steps 1 and 2 must be exactly prev_path and prev2_path, scope Event.

"No nav_step data yet"

The script isn't running or the event isn't reaching GA4 (Zaraz action). Look for the event in the Realtime report.

What is "(unknown)"?

The visitor opened the page in a new tab; the previous step isn't known in that tab.

Start with one site, free

The first site is free forever and asks for no card. Every extra site is $2.50 a month.