Whenever someone loads a page of your website or their browser history state is
changed by the active site, an enhanced measurement
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. This article 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
||No||document.title||The title of the page.|
The URL of the page.
If you override
||Whether or not a pageview should be sent.|
When you want to manually control how pageviews are sent (e.g. single-page applications or infinite scrolling), do the following:
Measure virtual pageviews
If your site loads page content dynamically and updates the document's URL, you
might want to send additional pageviews to measure these virtual pageviews. To
measure virtual pageviews, either rely on enhanced measurement, which sends a
pageview when the browser history state changes, or manually send the
If you manually send
page_view events, make sure enhanced measurement is
configured correctly to avoid double counting pageviews on history state
changes. Typically, this means disabling
Page changes based on browser history events under the advanced settings of
the pageviews section.
When a pageview is sent to Analytics, the default page parameter values are
used, unless modified. This means you do not need to modify
page_location parameters if updates to
window.location (e.g. via the
History API) and
document.title are made prior to the event being sent.
If your app relies on a library to handle page updates, it's recommended that
you review the behavior to confirm the library sets
document.title as expected. Alternatively, you can always explicitly set page
parameters when sending a
page_view event to ensure accuracy and clarity.