The page_view event in Google Analytics 4 (GA4)
The page_view
event in Google Analytics 4 (GA4) is arguably the most crucial event for many to track. It’s used to measure page views, forming the foundation for numerous other analyses.
A page view isn’t just loading a new page; it also includes navigating within a Single Page App (SPA). On such pages, the URL in the browser updates without technically reloading the page. However, since the user sees a new page, it should be counted as a new page view with its own page_view
event.
You can also use page_view
events for similar, comparable user interactions, such as steps in a complex, multi-stage form.
Many other web analytics tools treat page views and events separately. This was also the case with GA4’s predecessor, Universal Analytics. However, in GA4, page_view
is just another event like any other.
Implementation
Automatic Tracking
GA4 can automatically track page_view
events, capturing a page_view
event as soon as the website loads. This is active by default.
This applies to both code-based implementation with gtag.js and implementation via Google Tag Manager.
If you want to change this, you can set the configuration parameter send_page_view
to false
.
You can find more details in Google’s documentation:
- Tracking page_view events with code-based implementation using gtag
- Tracking page_view events with Google Tag Manager
Enhanced Measurement
If you have a Single Page App (SPA) and your developers – for whatever reason – aren’t specifically tracking page_view
events via gtag() or sending them via dataLayer, you can fall back on Enhanced Measurement.
This functionality automatically detects URL changes in the browser and generates page_view
events from them. While it doesn’t always work perfectly, it’s a good compromise and better than nothing.
If Enhanced Measurement is getting in your way and you’d like to turn it off, e.g., because you prefer to track page_view
events yourself, you can do so in your GA4 Data Stream settings: