Automatic Page Tracking

Narrowbeam automatically tracks page views without any configuration. Learn how automatic page tracking works and what data is collected.

Page views are tracked automatically as soon as you install the Narrowbeam script. No additional code is required.

How It Works

When the Narrowbeam script loads on your page, it automatically captures a page view event. This happens on:

  • Initial page load
  • Navigation in Single Page Applications (see SPA Tracking)
  • History API changes (pushState, replaceState, popstate)

What Gets Tracked

Each page view automatically captures the following information:

Data PointDescriptionExample
urlCurrent page URLhttps://example.com/products
referrerPrevious page or external referrerhttps://google.com
utm_sourceUTM source parameter (if present)newsletter
utm_mediumUTM medium parameter (if present)email
utm_campaignUTM campaign parameter (if present)spring-sale
utm_termUTM term parameter (if present)running-shoes
utm_contentUTM content parameter (if present)header-cta
pageview_idUnique identifier for this page viewabc123xyz

Pageview IDs

Each page view is assigned a unique pageview_id that links it to any custom actions that occur during that page session. This allows you to:

  • Track which actions happened on which pages
  • Analyze user behavior within a single page view
  • Build conversion funnels across pages

How Pageview IDs Work

When a page loads, Narrowbeam generates a unique ID for that page view. Any custom actions tracked during that page session (button clicks, form submissions, etc.) automatically include the same pageview_id, allowing you to see the complete picture of user activity on that page.

Referrer Tracking

The referrer is automatically captured from document.referrer and processed to:

  • Identify traffic sources (direct, search engines, social media, etc.)
  • Track internal navigation patterns
  • Measure campaign effectiveness

Referrer Limitations

Referrer information may be limited when users navigate from HTTPS to HTTP sites, or when referrer policies restrict this data. This is a browser security feature, not a Narrowbeam limitation.

Manual Page View Tracking

While page views are tracked automatically, you can manually trigger a page view event if needed:

// Manually track a page view
window.narrowbeam.trackPageView();
Manual tracking is rarely needed. Use this only for custom routing implementations or special cases where automatic tracking doesn't work.

Viewing Page View Data

In your Narrowbeam dashboard, page views appear as:

  • Views: Unique sessions viewing pages
  • Visitors: Unique people viewing pages (privacy-preserving count)
  • Top Pages: Widgets showing most-viewed URLs
  • Entry Pages: First page users see in their session
  • Exit Pages: Last page before leaving

Best Practices

  • Clean URLs: Use readable URLs without unnecessary query parameters for better reporting
  • Consistent Paths: Avoid tracking the same page under multiple URLs (e.g., with and without trailing slash)
  • UTM Parameters: Use UTM parameters for campaign tracking (see UTM Campaign Tracking)
  • SPA Setup: For single-page applications, ensure proper SPA tracking is configured (see SPA Tracking)

Related Documentation