Sub topic 1
How GA4 data is structured: events and parameters
Every Free-form exploration is a view over one kind of record: the event. If you know what an event contains, you can predict which fields an exploration will offer and why some are missing. This chapter covers the event model. The next chapters build on it with dimensions, metrics and scopes.
Prerequisites
This chapter assumes you have:
- Access to a GA4 property with at least Viewer permissions.
- Some familiarity with the standard reports (Reports > Acquisition, Engagement).
- A working idea of what a website or app event is, such as a page load or a button click.
- Comfort reading pivot tables or spreadsheets.
You do not need to write code. The short snippets below only show where the data comes from.
Everything is an event
Earlier versions of Google Analytics were built around the pageview and the session. GA4 uses one record type for every interaction: the event. A page load, a scroll, a purchase and a video play are all events.
An event has four parts:
- An event name, such as
page_vieworpurchase. - Event parameters, which are key-value pairs that describe this one occurrence.
- User properties, which are key-value pairs that describe the person and stay attached to them across events.
- Context that GA4 adds itself: timestamp, device, browser, country and traffic source.
Sessions, users and conversions are not stored as separate record types. GA4 derives them from events. A session is a group of events that share a session ID. A user is a count of distinct client or user identifiers.
The four kinds of events
GA4 groups events by who defines them. The group matters because it decides which parameters you can count on.
| Kind | Who defines it | Examples |
|---|---|---|
| Automatically collected | GA4 sends them with no setup | `first_visit`, `session_start`, `page_view` (web, through the default config), `user_engagement` |
| Enhanced measurement | GA4 sends them when the toggle is on | `scroll`, `click` (outbound), `file_download`, `view_search_results`, `video_start` |
| Recommended | Google defines the name and parameters, you implement them | `login`, `purchase`, `add_to_cart`, `generate_lead` |
| Custom | You define the name and parameters | `newsletter_signup`, `calculator_used` |
Use a recommended event when one fits your case. Google's reports and features recognize the names and parameters, so you get more built-in fields without extra work. A custom event is only as visible as you make it.
Parameters carry the detail
The event name tells you what happened. Parameters tell you the details. A purchase event can carry transaction_id, value, currency and an items array. A page_view carries page_location, page_referrer and page_title.
Here is a generate_lead event sent with gtag.js. It assumes the standard GA4 snippet is already on the page.
gtag('event', 'generate_lead', {
currency: 'USD',
value: 30,
form_name: 'newsletter'
});currency and value are recommended parameters for this event. form_name is a custom parameter that you invented. All three are stored with the event.
Several parameters are added for you. Two common ones are:
ga_session_id, the timestamp-based ID that ties events into a session.engagement_time_msec, the foreground time attached to an event. GA4 sums it to compute engagement time.
Parameters are not automatically fields
Sending a parameter does not make it appear in an exploration. A parameter you send is stored in the raw event, but the interface only lists fields GA4 knows how to report on. For your own parameters, you must register them as a custom dimension or custom metric in Admin > Custom definitions.
Registration has three consequences:
- It is not retroactive. A custom dimension only fills in for events collected after you register it. Earlier events still hold the parameter, but the reporting interface cannot show it.
- The type decides the field. A parameter registered as a dimension is text you can group by. A parameter registered as a custom metric is a number you can sum or average.
- The scope is fixed at registration. You pick event, user or item scope. The scope controls which other fields it can be combined with, which is the subject of the scopes chapter.
If a teammate says "the data is there but I can't find it in Explore", an unregistered parameter is the most likely cause.
Limits on events and parameters
Standard GA4 properties cap what you can send. Check Google's current documentation, because these numbers have changed over time. The values below apply to standard properties:
| Item | Standard property limit |
|---|---|
| Distinct event names | 500 per property |
| Event name length | 40 characters |
| Parameters per event | 25 |
| Parameter name length | 40 characters |
| Parameter value length | 100 characters |
| User properties | 25 |
| Event-scoped custom dimensions | 50 |
| User-scoped custom dimensions | 25 |
| Custom metrics | 50 |
Two limits cause most real problems. The first is the 500 distinct event names. Putting variable text such as a product ID into an event name uses up the allowance quickly and makes every report hard to read. Put variable text in a parameter instead. The second is the 100-character value limit. GA4 truncates longer values, so long URLs or search terms may show up cut off.
Event names are case sensitive
Sign_Up and sign_up are two separate events. A typo in an event name creates a second event that fragments your counts. Pick a naming convention, such as lowercase with underscores, and keep it. GA4 also reserves certain prefixes (for example google_, ga_ and firebase_) and some event and parameter names, and it drops events that use them.
What this means for Free-form explorations
The event model explains several behaviors you will see in Explore:
- The Event name dimension is always available. Because every record is an event, "Event name" with the "Event count" metric is the most basic table you can build.
- Event count and Sessions are different metrics. Event count counts every occurrence. Sessions counts distinct session IDs. A visitor who triggers
scrollfive times in one session adds 5 to Event count and 1 to Sessions. - Event-level detail needs a registered field. To break
generate_leaddown byform_name, you must registerform_nameas an event-scoped custom dimension first. - Session and user fields come from the first events. Fields such as "Session default channel group" describe the session as a whole, not one event. That is why mixing them with event-level fields can be restricted.
You can see all of this on a small example. Suppose one visit produces these events:
| Order | Event name | Parameters |
|---|---|---|
| 1 | `session_start` | `ga_session_id=1700000001` |
| 2 | `page_view` | `page_location=/pricing`, `ga_session_id=1700000001` |
| 3 | `scroll` | `percent_scrolled=90`, `ga_session_id=1700000001` |
| 4 | `generate_lead` | `form_name=newsletter`, `value=30`, `ga_session_id=1700000001` |
An exploration of this visit reports 4 events, 1 session, 1 user (assuming one client ID) and 1 generate_lead event worth 30. The percent_scrolled value of 90 is only visible once it is registered as a custom dimension or reported through its built-in field.
Common mistakes
- Sending a parameter and expecting it in Explore. Register it as a custom definition first, and remember the data starts from registration.
- Using unstable event names. Name drift splits one behavior across several events. Keep a shared tracking plan.
- Encoding data in the event name. Names like
click_button_reduse the name limit up fast. Use aclickevent with abutton_colorparameter. - Sending personal data. Google's terms prohibit sending personally identifiable information, such as email addresses, in event parameters or user properties.
Exercise
A developer adds gtag('event', 'video_play', { video_title: 'Intro' }) to a site on Monday. On Friday you register video_title as an event-scoped custom dimension. You then build a Free-form exploration with video_title as rows for the whole week. What do you expect to see for Monday through Thursday, and why?
Show answer
Monday through Thursday events will not show a video_title value, so they appear as "(not set)". Custom dimensions are not retroactive. The parameter was stored in the raw events, but the reporting interface only populates a custom dimension for events collected after registration. Only events from Friday onward will show "Intro".
Exercise
A visitor opens one session and triggers 1 session_start, 3 page_view and 2 scroll events. What are the values of Event count and Sessions for that visitor?
Show answer
Event count is 6, because it counts every event (1 + 3 + 2). Sessions is 1, because all six events share a single session ID.