Sub topic 3
Event parameters: adding context to an event
Assume you know the basic GA4 interface, can read JavaScript objects, and understand that a GA4 event records something a user or system did. This chapter focuses on the information attached to that event.
An event parameter is a named value that adds context to one event. The event name describes the action, while parameters describe details about that action.
For example, purchase identifies a purchase. Its parameters can identify the order, currency, total value, and products:
gtag('event', 'purchase', {
transaction_id: 'T_12345',
value: 59.98,
currency: 'USD',
items: [
{
item_id: 'SKU_123',
item_name: 'Trail Shoes',
price: 29.99,
quantity: 2
}
]
});Here, transaction_id, value, and currency are event parameters. The items parameter contains an array of product objects. Each product object has additional fields, such as item_id and quantity.
Events, parameters, and user properties
These three data types answer different questions:
| Data type | What it describes | Example |
|---|---|---|
| Event | An action that happened | `purchase` |
| Event parameter | Context for one action | `currency: 'USD'` |
| User property | A lasting user characteristic | `membership_level: 'pro'` |
Use an event parameter when the value belongs to a specific occurrence. A product’s price may change between purchases, so it belongs on each purchase event. Use a user property when the value describes the user across multiple events, such as a membership level.
GA4 includes parameters automatically for some events. Recommended events also have predefined parameters. Using those names helps GA4 interpret the data correctly. For example, the login event supports the recommended method parameter:
gtag('event', 'login', {
method: 'Google'
});A parameter name alone does not create a useful report. The value must also use a consistent format. For example, always send currency as a three-letter ISO code such as USD, and send numeric revenue as a number rather than the string "59.98".
Choosing parameter names
When a recommended event does not provide enough context, add a custom parameter. Use lowercase snake_case names, such as placement or plan_type.
gtag('event', 'newsletter_signup_click', {
placement: 'footer',
plan_type: 'free'
});Keep each parameter focused on one fact. Prefer button_color: 'blue' and button_position: 'header' over a single value such as button_description: 'blue header button'. Focused values are easier to filter, compare, and validate.
Avoid sending personal information, such as names, email addresses, phone numbers, or customer records. GA4 also has limits on parameter names, values, and event payloads. Check the current GA4 limits before designing a large or complex schema.
How parameters move through a system
With Google Tag Manager, a page can push an object to the data layer. A Custom Event trigger listens for the event field, and a GA4 Event tag maps the other fields to event parameters.
Document each parameter’s name, type, allowed values, and source. This prevents one implementation from sending plan_type: 'free' while another sends plan: 'Free'.
Exercise
A website sends a video_start event with video_title, video_length, and user_email. Which field should be removed, and why?
Show answer
Remove user_email. It is personal information and is not needed to describe the video event. Keep the event context, but use non-identifying fields.