Stay organized with collections
Save and categorize content based on your preferences.
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.
If you override page_location, the value must start
with the protocol followed by the full URL; for example,
https://www.example.com/contact-us-submitted.
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:
[null,null,["Last updated 2024-10-09 UTC."],[[["\u003cp\u003eBy default, Google Analytics automatically sends a \u003ccode\u003epage_view\u003c/code\u003e event whenever a page loads or the browser history changes.\u003c/p\u003e\n"],["\u003cp\u003eFor single-page applications or websites with infinite scrolling, you might need to manually control how \u003ccode\u003epage_view\u003c/code\u003e events are sent to avoid duplicates or inaccurate data.\u003c/p\u003e\n"],["\u003cp\u003eTo manually send \u003ccode\u003epage_view\u003c/code\u003e events, first disable the default pageview measurement, and then use the \u003ccode\u003epage_view\u003c/code\u003e event with relevant parameters like \u003ccode\u003epage_title\u003c/code\u003e and \u003ccode\u003epage_location\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003epage_view\u003c/code\u003e event includes parameters like \u003ccode\u003epage_title\u003c/code\u003e and \u003ccode\u003epage_location\u003c/code\u003e, which by default are populated with the document title and URL, respectively.\u003c/p\u003e\n"]]],["The `page_view` event is automatically sent to Google Analytics when a webpage loads or its browser history state changes. This default behavior can be disabled for manual control, especially useful for single-page applications or infinite scrolling. When disabling the default `page_view`, you are responsible for manually sending them. Default `page_view` data include `page_title` and `page_location` which are set automatically. When sending manual pageviews, be sure to disable default behavior to avoid duplicate entries.\n"],null,["# Measure pageviews\n\nWhenever someone loads a page of your website or their browser history state is\nchanged by the active site, an [enhanced measurement\nevent](//support.google.com/analytics/answer/9216061#page_view) called\n`page_view` is sent from your website to Google Analytics. Since the event is\nsent automatically, you don't need to send pageview data to Analytics manually.\n\nHowever, when you want to manually control how pageviews are sent (e.g.\nsingle-page applications or infinite scrolling), you can disable pageviews and\nthen manually send them from your website. Learn how to [Measure single-page\napplications](/analytics/devguides/collection/ga4/single-page-applications).\n\nThis document describes the default pageview behavior and then how to send your\nown pageviews manually.\n\nFor information about how to measure screenviews on a mobile app, see [Measure\nscreenviews](//firebase.google.com/docs/analytics/screenviews) instead.\n\n\u003cbr /\u003e\n\n\ngtag.js Tag Manager\n\nBefore you begin\n----------------\n\nDefault behavior\n----------------\n\n| Name | Type | Required | Default value | Description |\n|------------------|-----------|----------|-----------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `page_title` | `string` | No | [document.title](https://developer.mozilla.org/docs/Web/API/Document/title) | The title of the page. |\n| `page_location` | `string` | No | [location.href](https://developer.mozilla.org/docs/Web/API/Location/href) | The URL of the page. If you override `page_location`, the value must start with the protocol followed by the full URL; for example, https://www.example.com/contact-us-submitted. | **Note:** The default value excludes the fragment portion of the URL. |\n| `send_page_view` | `boolean` | No | `true` | Whether or not a pageview should be sent. |\n\nManual pageviews\n----------------\n\nWhen you want to manually control how pageviews are sent (e.g. single-page\napplications or infinite scrolling), do the following:\n\n1. [Disable pageview measurement](#disable_pageview_measurement)\n2. [Send the `page_view` event when appropriate](#page_view_event)\n\n| **Caution:** If you send manual pageviews without disabling pageview measurement, you may end up with duplicate pageviews."]]