An event parameter is an additional piece of data about a user interaction on a website and/or app, offering valuable context and details about the interaction.
Note: To understand the event parameters for automatically collected and recommended events, and how each parameter updates a dimension or metric in Google Analytics, see Google Analytics event parameters.
By using the data from an event parameter, you can dissect user behavior with a high level of granularity. For example, you can use an event parameter to pinpoint precisely which videos were viewed, which buttons were clicked, or which products were placed in a shopping cart.
When to add event parameters
Automatically collected events, like 'click,' come with event parameters that update with data from your website and/or app. The event parameters for the 'click' event are updated automatically when a user clicks a button or link, enabling you to dissect what a user clicked.
We also provide a list of event parameters that you should set up when adding recommended events to your website and/or app. These event parameters unlock prebuilt dimensions and metrics that you can use in reports and audiences.
Finally, when you set up a recommended or custom event, you can add custom event parameters so you can learn more about the interaction. For example, when you're setting up the 'search' recommended event, you can add the custom event parameter 'search_location' to identify which search feature someone used on your website.
How to add event parameters
To add an event parameter, use key-value pairs. The value on the left of the pair is the parameter, and the value on the right is the value of the parameter. For example, consider the following recommended gtag.js event called 'level_end':
gtag("event", "level_end", {
level_name: "The journey begins...",
success: true
});
The event above includes two event parameters:
- level_name describes the name of the level that they player reached the end of
- success indicates whether the level was completed successfully
When you add the code above to your website's JavaScript, for example, the event and its parameters are sent to Google Analytics automatically.
Event parameters vs. dimensions and metrics
Event parameters are used to gather data from a website or app.
The data from event parameters feeds into dimensions and metrics. These dimensions and metrics are available in reports, explorations, and other surfaces throughout Google Analytics so you can analyze the data from event parameters.
In other words, event parameters let you collect data, while dimensions and metrics let you analyze the data.