Measure pageviews and screenviews

Stay organized with collections Save and categorize content based on your preferences.

Analytics automatically collects data about pageviews from your websites and web apps and screenviews from your mobile apps. This article describes how to send and disable pageviews and screenviews manually.

Before you begin

Add the Google tag to your website and make sure you can access Analytics and the website source code.

Measure pageviews

The gtag.js snippet includes a config command that sends a pageview when a user visits a page on your site:

gtag('config', 'TAG_ID');

You can add parameters after the tag ID as follows to capture metadata about the pageview:

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

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

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

Analytics will use default values for any parameters that 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.

Disable pageviews

If you don’t want gtag.js to send a pageview, set the send_page_view parameter to false. The send_page_view parameter does not persist across pages. This setting must be repeated on every page of your website where you want to disable automatic pageviews.

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