6 min read

How to Track Path Exploration in Google Analytics 4

Understanding how users navigate through your site is crucial for optimizing user experience and conversion funnels. GA4's event-based model makes path tracking more flexible than Universal Analytics, but you need to know which events to capture and how to structure them. This guide shows you how to set up reliable path tracking and analyze user journeys in GA4.

Set Up Event Tracking for Page Navigation

Every page view in GA4 is captured as an event with standard parameters like page_path, page_title, and page_referrer. You'll build on this foundation to track the paths users actually take.

Install the GA4 tracking snippet

Add the gtag.js script to the <head> of your HTML. Get your Measurement ID from Admin > Data streams > [Your stream] > Measurement ID.

javascript
<!-- Add to your <head> -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-MEASUREMENT_ID"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
  gtag('config', 'G-MEASUREMENT_ID');
</script>
GA4 tracking initialization — page_view events are sent automatically

Add custom parameters to enrich path data

GA4 tracks page_path by default, but adding parameters like navigation_source or content_type tells you *why* users took a path. Manually send page_view events with additional context.

javascript
// Track when users navigate with extra context
gtag('event', 'page_view', {
  'page_path': '/products/amplitude',
  'page_title': 'Amplitude - Analytics Platform',
  'navigation_source': 'search_results',  // where they came from
  'content_type': 'product_detail',      // what they're viewing
  'category': 'analytics_tools'           // for grouping paths
});
Enriching page_view with custom parameters to track path context
Watch out: GA4 limits you to 25 custom parameters per event. Keep names short and reuse them across events (not page-specific).

Use GA4's Path Exploration Tool to Visualize Journeys

Once events are flowing, GA4's Exploration reports let you see the actual paths users take. The path exploration visualization is designed exactly for this.

Create a path exploration report

Go to Explore > Create new > Path exploration. Set Starting point to page_path, Next step to page_title, and GA4 will show you the most common user sequences.

javascript
// Structure your events so path exploration is readable
// Step 1: Category page
gtag('event', 'page_view', {
  'page_path': '/categories/analytics-tools',
  'page_title': 'Analytics Tools Category',
  'step_number': 1
});

// Step 2: Product list (with filter applied)
gtag('event', 'page_view', {
  'page_path': '/products',
  'page_title': 'Products - Filtered by Analytics',
  'step_number': 2,
  'filter_type': 'category_filter',
  'filter_value': 'analytics'
});

// Step 3: Product detail
gtag('event', 'page_view', {
  'page_path': '/products/amplitude',
  'page_title': 'Amplitude Details',
  'step_number': 3,
  'product_id': 'amplitude'
});
Sequencing page_view events so they form a clear funnel in path reports

Filter paths by user segment

In the path exploration report, add a filter like User properties > user_tier = premium_user to see if high-value users follow different navigation patterns.

javascript
// Set user properties to enable segmentation
gtag('set', {
  'user_properties': {
    'user_tier': 'premium_user',
    'signup_month': '2024-01',
    'industry': 'saas',
    'company_size': 'enterprise'
  }
});

// Or set during config:
gtag('config', 'G-MEASUREMENT_ID', {
  'user_id': 'USER_ID_123',
  'user_properties': {
    'loyalty_tier': 'vip'
  }
});
Setting user properties to segment path analysis by user type
Tip: GA4 shows the last 10 steps in a path exploration. If users take more than 10 actions before converting, you'll miss earlier steps — track intentional goals as events instead.

Track Custom Events for Non-Page Actions

Page views don't capture everything. Use custom events to track clicks, form submissions, and feature usage — then link them to page views to reconstruct the full path.

Send custom events for key user actions

Create custom events for interactions that don't change pages, like clicking a Try Free button or submitting a form. Use event parameters to describe what happened.

javascript
// Track a CTA click
document.getElementById('signup-btn').addEventListener('click', function() {
  gtag('event', 'click_cta', {
    'cta_text': 'Try Free',
    'cta_location': 'hero_section',
    'page_context': '/features'
  });
});

// Track form submission
gtag('event', 'form_submit', {
  'form_name': 'product_inquiry',
  'form_step': 'contact_info',
  'fields_filled': 4
});

// Track a search
gtag('event', 'search', {
  'search_term': 'amplitude pricing',
  'search_results_count': 8,
  'search_source': 'site_search'
});
Custom events to track micro-interactions along the user path

Link custom events to page views with a journey ID

Add a journey_id parameter to both page_view and custom events so you can reconstruct the full path later in BigQuery or an export.

javascript
// Generate a unique journey ID (once per session)
const journeyId = 'j_' + Date.now() + '_' + Math.random().toString(36).substr(2, 9);

// Event 1: Search
gtag('event', 'search', {
  'journey_id': journeyId,
  'search_query': 'best analytics tool',
  'results_shown': 5
});

// Event 2: Click a result
gtag('event', 'search_click', {
  'journey_id': journeyId,
  'result_title': 'Amplitude Overview',
  'result_position': 2
});

// Event 3: Land on page
gtag('event', 'page_view', {
  'journey_id': journeyId,
  'page_path': '/tools/amplitude',
  'page_title': 'Amplitude'
});
Linking events with a journey_id to reconstruct complete user paths
Watch out: GA4 drops events if you exceed 100 events per second on your property. Don't track every keystroke or scroll — be selective about what's a meaningful action.

Common Pitfalls

  • Forgetting to set data retention — GA4 defaults to 2 months. If you need longer path history, change it to 14 months in Admin > Data settings > Data retention.
  • Not tracking navigation on single-page apps — if your site uses client-side routing (React, Vue), page_view won't fire on route changes. Send custom page_view events manually in your router.
  • Mixing tracking methods — if you use both gtag.js and Google Tag Manager on the same page, you'll double-count events. Choose one.
  • Using page_path as the only path dimension — GA4 truncates page paths longer than 2000 characters. If URLs are dynamic or contain query strings, add a custom page_category parameter instead.

Wrapping Up

You now have three ways to track user paths in GA4: automatic page_view events, GA4's built-in path exploration reports, and custom events for non-page interactions. GA4's event-based model is flexible but requires intentional setup. If you want to track this automatically across tools and platforms, Product Analyst can help.

Track these metrics automatically

Product Analyst connects to your stack and surfaces the insights that matter.

Try Product Analyst — Free