Sub topic 1
How GA4 Models Data: Events, Parameters, and User Properties
Prerequisites
This chapter assumes you can open a GA4 property, that you have a web data stream, and that you can read basic JavaScript objects and function calls. You should also know that a website sends data to GA4 through a tag installed on its pages.
The event-based data model
GA4 records every interaction as an event. An event has a name, such as page_view, and can carry parameters. A parameter is a key-value pair that adds context, such as method: 'Google'. User properties describe the person rather than one action, such as a subscription plan or a preferred language.
The four kinds of events
GA4 sorts events into four groups.
| Kind | Who sends it | Example |
|---|---|---|
| Automatic | GA4, without extra code | `first_visit` |
| Enhanced measurement | GA4, from page interactions you switch on | `scroll` |
| Recommended | You, with a predefined name and parameters | `login` |
| Custom | You, with a name you choose | `newsletter_signup_click` |
Event parameters: adding context to an event
Parameters answer questions about an event, such as how the user signed up. Send them in the third argument of gtag.
gtag('event', 'sign_up', {
method: 'email'
});What GA4 already collects for you
GA4 collects automatic events on every page with no code. Enhanced measurement adds events such as scroll, file_download, and outbound clicks. You turn these on in the data stream settings.
> Enhanced measurement events appear only after you enable them in the data stream.
Recommended events: predefined names and parameters
Recommended events have fixed names and parameters that GA4 reports understand. Use one when it matches your action. The login event takes a method parameter.
gtag('event', 'login', {
method: 'Google'
});Exercise
A visitor clicks a newsletter signup button, and no recommended event fits. Which event kind should you use, and what is a valid name?
Show answer
Use a custom event. A valid name is newsletter_signup_click, written in snake_case.