Measure pageviews

The Google Analytics tag automatically sends a pageview hit, unless you disable pageview measurement. However, you may want to send pageview hits to Google Analytics on an ad-hoc basis.


Use the config command to send a pageview:

gtag('config', 'GA_MEASUREMENT_ID', {<pageview_parameters>});

where GA_MEASUREMENT_ID is your Google Analytics ID and <pageview_parameters> is one or more parameter-value pairs. Separate each pair by a comma. For example, this code sends a pageview to Google Analytics with a page title of 'homepage' and a page path of '/home'.

gtag('config', 'GA_MEASUREMENT_ID', {
  'page_title' : 'homepage',
  'page_path': '/home'

Pageview parameters

The following table lists pageview-related parameters.

Parameter name Value type Required Description
page_title string No The page's title.
page_location string No The page's URL.
page_path string No The path portion of location. This value must start with a slash (/) character.

Multiple properties

To send a pageview to multiple Google Analytics properties, specify a config for each property.

gtag ('config', 'GA_MEASUREMENT_ID_1');
gtag ('config', 'GA_MEASUREMENT_ID_2');