AI-generated Key Takeaways
-
By default, Google Analytics automatically sends a
page_viewevent whenever a page loads or the browser history changes. -
For single-page applications or websites with infinite scrolling, you might need to manually control how
page_viewevents are sent to avoid duplicates or inaccurate data. -
To manually send
page_viewevents, first disable the default pageview measurement, and then use thepage_viewevent with relevant parameters likepage_titleandpage_location. -
The
page_viewevent includes parameters likepage_titleandpage_location, which by default are populated with the document title and URL, respectively.
Whenever someone loads a page of your website or their browser history state is
changed by the active site, an enhanced measurement
event called
page_view is sent from your website to Google Analytics. Since the event is
sent automatically, you don't need to send pageview data to Analytics manually.
However, when you want to manually control how pageviews are sent (e.g. single-page applications or infinite scrolling), you can disable pageviews and then manually send them from your website. Learn how to Measure single-page applications.
This document describes the default pageview behavior and then how to send your own pageviews manually.
For information about how to measure screenviews on a mobile app, see Measure screenviews instead.
Before you begin
Default behavior
| Name | Type | Required | Default value | Description |
|---|---|---|---|---|
page_title |
string |
No | document.title | The title of the page. |
page_location |
string |
No | location.href |
The URL of the page.
If you override |
send_page_view |
boolean |
No | true |
Whether or not a pageview should be sent. |
Manual pageviews
When you want to manually control how pageviews are sent (e.g. single-page applications or infinite scrolling), do the following: