Set up event parameters

This guide shows you how to set up parameters for recommended events and custom events on your website so you can collect more information from your events. For information about how to add item-scoped parameters, see Measure ecommerce.

Audience

You want to collect more information about your users' activity through the events you've already set up.

You use either the Google tag (gtag.js) or Google Tag Manager on your website. If you want to set up event parameters for a mobile app, see Log events.


Before you begin

This guide assumes that you've done the following:

It also assumes that you have the following:

  • Access to the Tag Manager container for the website
  • The Editor (or above) role to the Google Analytics account

You should also read Set up events before reading this guide.

Understand event parameters

Parameters provide additional information about the ways users interact with your website. For example, when someone views a product you sell, you can include parameters that describe the product they viewed, such as the name, category, and price.

The automatically collected and enhanced measurement events include parameters by default. Google also provides a set of required and optional parameters to include with each recommended event. Additionally, you can add more event parameters when you need them.

Set up event parameters

The following steps show you how to add parameters to a custom event called "Signup newsletter" so that the event includes the label of the button that the user clicked. These steps assume that you've followed the steps in Set up events.

Step 1: Create variables for the event parameters

  1. In Google Tag Manager, go to Tags.
  2. Open your Google Analytics: GA4 Event tag.
  3. In Tag Configuration, expand Event Parameters.
  4. In Parameter Name, enter a name for the parameter (e.g., button_label).
  5. In Value, click An image of the Add variable icon next to the field to add a variable.
  6. Choose a variable for the value of the event parameter (e.g., choose Click Text for the text of the button clicked).

    If you use a data layer object, you can select + in the top right and choose Data Layer Variable.

  7. Save your changes and publish your container.

Your configuration might look something like this:

The tag configuration in Step 1

Step 2: Preview your changes

Before you publish your new event in Tag Manager, click Preview to see the data that's recorded when you click the "Sign up for the newsletter" button.

You can use preview mode to test changes to your container before you publish those changes to your website. Learn more about preview mode

See your events in Analytics

When you are ready to publish your changes, click Submit.

You can see your events and their parameters using the Realtime and DebugView reports. Note that the DebugView report requires some additional configuration before you can use the report. These two reports show you the events users trigger on your website as the events are triggered.

Some parameters automatically populate prebuilt dimensions and metrics in Google Analytics. For example, the parameters on the automatically collected and enhanced measurement events, as well as the required and optional parameters you send with the recommended events, populate pre-built dimensions and metrics.

Other parameters require you to create custom dimensions and metrics to see the parameter values in Google Analytics. Whenever you create a custom parameter, you need to create a corresponding custom dimension or metric so you can see that data.

Next steps

Create custom dimensions and metrics for your custom event parameters.