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 (October 1, 2023 for Analytics 360 properties).

[GA4] Add custom parameters to automatically collected events

Adding custom parameters to automatically collected events enables you to capture information that Analytics does not capture by default. For example, you can capture the author and category on a page by adding custom parameters to the page_view event.

To add custom parameters to automatically collected events, do one of the following:

  • Disable and then manually recreate an event with additional parameters
  • Send a custom event specifically to capture additional parameters
  • Add custom parameters to all events

Once you add custom parameters to automatically collected events, map the parameters to custom dimensions and metrics so you can use the parameters for reporting.

Disable and then manually recreate an event

If the automatically collected events don't capture all the data you need, you can disable the events and then recreate them as custom events with custom parameters. When you recreate the events with custom parameters, include the parameters that would normally be collected with the events by default.

You can disable enhanced measurement events in Admin. You can disable page_view events by setting send_page_view: false when you use the global site tag (gtag.js) or by clearing the "Send a page view event when this configuration loads" option on the GA4 Configuration tag when you use Tag Manager.

Note: Because page_location and page_referrer are collected by default with every event, including custom events, you don't need to set these parameters when you manually send a page_view event.

For mobile apps, you can disable automatically tracked screen_view events and then manually track them in the code.

Send a custom event to capture additional parameters

You can also use a custom event to capture additional parameters. For example, you can create a custom event called record_page_metadata that records only the author and category on a page. For mobile apps, you can add custom parameters to manually tracked screenviews. For example, you can create a custom event called screen_view_duplicate with a custom parameter page_topic=education-opportunities.

Note: Sending duplicate events increases the total number of events captured at a given time, which could trigger sampling within shorter date ranges or at smaller sample sizes.

This approach may be best when you want to record custom parameters for a small portion of pageviews or screenviews, or when you don't expect to approach the sampling limit.

Add custom parameters to all events

Alternatively, you can add custom parameters to all events. When you use the global site tag (gtag.js), you can set persistent values using the config or set command. When you use Tag Manager, set persistent values using the data layer and add parameters you want to configure in Fields to Set. For mobile apps, set global parameters using the setDefaultEventParameters() API.

Note: Sending duplicate events increases the total number of events captured at a given time, which could trigger sampling within shorter date ranges or at smaller sample sizes.

Was this helpful?
How can we improve it?
Search
Clear search
Close search
Google apps
Main menu
Search Help Center
true
69256
false