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:
- Create a Google Analytics account and property
- Create a web data stream for your website
- Place the Tag Manager snippets on your website
- Install the Google tag in Tag Manager
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
- In Google Tag Manager,
go to
Tags.
- Open your Google Analytics: GA4 Event tag.
- In Tag Configuration, expand Event Parameters.
- In Parameter Name, enter a name for the parameter (e.g.,
button_label
). - In Value, click
next to the field to add a variable.
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.
Save your changes and publish your container.
Your configuration might look something like this:
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.