This article is about Google Analytics 4 properties. Refer to the Universal Analytics section if you're still using a Universal Analytics property, which will stop processing data on July 1, 2023 (July 1, 2024 for Analytics 360 properties).

[GA4] Measure pages and screens

Collect information about the pages and screens your users visit

Google Analytics collects information about your web pages and app screens by adding information about them to events. You can use this information to populate dimensions and metrics to see which pages and screens your users interact with.

While Google collects data about pages and screens automatically, you can also manually collect information about your pages and screens.

Measure pages and screens automatically

Use the following drop-downs to learn how Google Analytics measures pages and screens:

Google tag (Websites)

The Google tag snippet includes a config command that collects pageview data:

gtag('config', 'TAG_ID');

You can add parameters to the config command after the tag ID to capture more information about the pageview. Use the following structure to capture parameters:

gtag('config', 'TAG_ID', <parameters>);

For example, you can include the following parameters to capture the page URL and title:

gtag('config', 'TAG_ID', {
  page_title: 'My Profile',
  page_location: 'https://example.com/me' // Include the full URL
});

Google Tag Manager (Websites)

When you set up the Google Analytics 4 Configuration tag, make sure to keep the Send a page view event when this configuration loads option selected to automatically send pageviews.

Google Analytics for Firebase (Mobile apps)

Once you install the Google Analytics for Firebase SDK, see Measure screenviews in the Firebase documentation for details on how screenviews are measured on mobile apps.

Disable pageviews and screenviews

Use the following drop-downs to see information about how to disable pageviews and screenviews:

Google tag (Websites)

To disable a pageview, set the send_page_view parameter to "false" as follows:

gtag('config', 'TAG_ID', {
  send_page_view: false
});

The parameter does not persist across pages; you must repeat the setting on every web page to disable automatic pageviews. 

Google Tag Manager (Websites)

When you set up the Google Analytics 4 Configuration tag, clear the Send a page view event when this configuration loads option to automatically disable pageviews.

Google Analytics for Firebase (Mobile apps)

Once you install the Google Analytics for Firebase SDK, see Measure screenviews in the Firebase documentation for details on how to disable screenviews on a mobile app.

Measure pages and screens manually

Use the following drop-downs to see information about how to send pages and screens manually:

Google tag (Websites)

To send your own pageviews, add the following event:

gtag('event', 'page_view', {
  page_title: 'My Profile',
  page_location: 'https://example.com/me', // Include the full URL
  send_to: '<MEASUREMENT_ID>'
});

Google uses default values for any parameters you don't set. Only set the send_to parameter when you want to send the page_view event to a different property than the one configured in the default snippet.

Google Tag Manager (Websites)

Once you set up a Google Analytics 4 Configuration tag, you can fire the tag when pages are loaded in web browsers using page view triggers.

Google Analytics for Firebase (Mobile apps)

Once you install the Google Analytics for Firebase SDK, see Measure screenviews in the Firebase documentation for details on how to measure screenviews manually on a mobile app.

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, do one of the following:

  • Rely on Enhanced measurement, which is enabled by default and sends a pageview when the browser history state changes.
  • Manually measure virtual pageviews by relying on the default snippet behavior or the page_view event to send a pageview.

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 Page views 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_title or 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 window.location and document.title as expected. Alternatively, you can always explicitly set page parameters when sending a page_view event to ensure accuracy and clarity.
Was this helpful?
How can we improve it?

Need more help?

Sign in for additional support options to quickly solve your issue

Search
Clear search
Close search
Google apps
Main menu
Search Help Center
false
false
true
true
69256
false
false