Sub topic 1
How GA4 Models Events, Parameters and Users
Prerequisites
This chapter assumes you can open a GA4 property and read basic JavaScript. You should know that GA4 is event-based, so each recorded interaction is an event with a name.
The GA4 data model
GA4 stores every interaction as an event. Each event has a name and can carry parameters. Users can also carry user properties. Together, these pieces describe what happened and who did it.
Event parameters: describing what happened
An event parameter is a key-value pair attached to one event. It describes that single occurrence. Parameters are sent with each event and do not carry over to the next one.
gtag('event', 'select_plan', {
plan_tier: 'pro',
billing_cycle: 'annual'
});User properties: describing who did it
A user property is a key-value pair attached to a user. GA4 applies it to that user's later events until the value changes.
gtag('set', 'user_properties', {
customer_type: 'subscriber'
});Item parameters in ecommerce events
Ecommerce events include an items array. Each item is an object with its own parameters, such as item_id and item_name. You can add custom item parameters, such as item_color, inside each item.
| Level | Example key | Where it is sent |
|---|---|---|
| Event parameter | plan_tier | Top level of the event |
| User property | customer_type | Set with user_properties |
| Item parameter | item_color | Inside the items array |
Choosing a scope: event, user or item
The scope determines which level a custom dimension reads. Match the scope to how long the value lasts.
- Event scope: the value changes with each event, such as
billing_cycle. - User scope: the value stays stable for a person, such as
customer_type. - Item scope: the value belongs to each product in an ecommerce event, such as
item_color.
Exercise
A store wants to report sales by warranty length. Each product in the cart has its own warranty. Which scope should the custom dimension use?
Show answer
Item scope. The warranty value belongs to each product inside the items array, not to the whole event or the user.