Automatic Page Tracking
Narrowbeam automatically tracks page views without any configuration. Learn how automatic page tracking works and what data is collected.
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 Point | Description | Example |
|---|---|---|
url | Current page URL | https://example.com/products |
referrer | Previous page or external referrer | https://google.com |
utm_source | UTM source parameter (if present) | newsletter |
utm_medium | UTM medium parameter (if present) | |
utm_campaign | UTM campaign parameter (if present) | spring-sale |
utm_term | UTM term parameter (if present) | running-shoes |
utm_content | UTM content parameter (if present) | header-cta |
pageview_id | Unique identifier for this page view | abc123xyz |
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();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)