Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
Cada vez que un usuario carga una página de tu sitio web o el sitio activo cambia el estado del historial de navegación, se envía un evento de medición optimizada llamado page_view de tu sitio web a Google Analytics. Dado que el evento se envía automáticamente, no es necesario que envíes datos de vistas de página a Analytics de forma manual.
Sin embargo, cuando quieras controlar de forma manual cómo se envían las vistas de página (p.ej., aplicaciones de una sola página o desplazamiento infinito), puedes inhabilitarlas y, luego, enviarlas de forma manual desde tu sitio web. Obtén información para medir aplicaciones de una sola página.
En este documento, se describe el comportamiento predeterminado de las vistas de página y, luego, cómo enviar tus propias vistas de página de forma manual.
Para obtener información sobre cómo medir las vistas de pantalla en una aplicación para dispositivos móviles, consulta Cómo medir las vistas de pantalla.
Si anulas page_location, el valor debe comenzar con el protocolo seguido de la URL completa; por ejemplo, https://www.example.com/contact-us-submitted.
send_page_view
boolean
No
true
Indica si se debe enviar o no una vista de página.
Vistas de página manuales
Cuando desees controlar manualmente cómo se envían las vistas de página (p.ej., aplicaciones de una sola página o desplazamiento infinito), haz lo siguiente:
[null,null,["Última actualización: 2024-11-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."]]