Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
Za każdym razem, gdy ktoś wczyta stronę w Twojej witrynie lub gdy aktywna witryna zmieni stan historii przeglądania, z Twojej witryny do Google Analytics zostanie wysłane zdarzenie objęte pomiarem zaawansowanym o nazwie page_view. Ponieważ to zdarzenie jest wysyłane automatycznie, nie musisz ręcznie wysyłać do Analytics danych o wyświetleniu strony.
Jeśli jednak chcesz ręcznie kontrolować sposób wysyłania zdarzeń pageview (np. w przypadku aplikacji jednostronicowych lub nieskończonego przewijania), możesz je wyłączyć, a potem wysłać je ręcznie z Twojej witryny. Dowiedz się, jak mierzyć aplikacje jednostronicowe.
W tym dokumencie opisujemy domyślne zachowanie odsłony, a potem wyjaśniamy, jak ręcznie przesyłać własne odsłony.
Informacje o tym, jak mierzyć wyświetlenia ekranu w aplikacji mobilnej, znajdziesz w artykule [GA4] Pomiar wyświetleń ekranu.
Jeśli zastąpisz wartość page_location, musisz zacząć od protokołu, a następnie podać pełny adres URL, np. https://www.example.com/contact-us-submitted.
send_page_view
boolean
Nie
true
Określa, czy należy wysłać działanie odsłony.
Ręczna liczba wyświetleń strony
Jeśli chcesz ręcznie kontrolować sposób wysyłania informacji o odsłonach (np. w przypadku aplikacji jednostronicowych lub przewijania nieskończonego), wykonaj te czynności:
[null,null,["Ostatnia aktualizacja: 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."]]