Sub topic 1
How GA4 records events and parameters
This chapter explains the data model that sits under every key event. You need to know how GA4 stores an event and its parameters before you can mark anything as a key event. The later chapters build on this one.
Prerequisites
This chapter assumes you have the following:
- A GA4 property with a web data stream installed.
- Editor access to the property.
- Basic familiarity with the Reports and Admin areas of GA4.
- A basic idea of what a form submission or a checkout is on a website.
- Optional: access to Google Tag Manager or to the site's code, if you want to try the examples.
You do not need to know how to code. You do need to be able to read short JavaScript snippets.
The event model in one sentence
GA4 records every interaction as an event. An event is a named record of something that happened, such as a page view, a click, a form submission, or a purchase. Each event carries a set of parameters that describe it.
Older Universal Analytics used separate hit types (pageview, event, transaction) with a fixed category, action, and label. GA4 has one model for everything. A page view is an event called page_view. A purchase is an event called purchase. This is why key events, which are the subject of this tutorial, are simply events that you flag as important.
Anatomy of an event
Every event has the same parts.
| Part | What it is | Example |
|---|---|---|
| Event name | A string that says what happened | `generate_lead` |
| Event parameters | Name and value pairs that add detail to that one event | `value: 25.00` |
| User properties | Attributes about the person, which stay the same across events | `customer_tier: gold` |
| Automatic context | Data GA4 attaches itself | timestamp, page URL, device, source |
The first two parts are the ones you control most often. The event name is what you later mark as a key event. The parameters are what make the event useful. For example, purchase with no value tells you that sales happened but not how much money they brought in.
Event names
Event names are case sensitive. Generate_Lead and generate_lead are two different events, and GA4 will report them separately. Use lowercase letters, digits, and underscores. Start the name with a letter. Names cannot begin with reserved prefixes such as google_, ga_, or firebase_.
A property has limits on how many distinct event names it can collect. Standard properties allow up to 500 distinct event names per app instance or web stream. If you generate names dynamically, for example click_button_blue, click_button_red, you can reach the limit quickly. A single name such as button_click with a button_color parameter avoids this.
Event parameters
A parameter is a key and a value attached to one event. Parameters are sent in the same request as the event name. A single event can carry up to 25 custom parameters, parameter names can be up to 40 characters, and string values can be up to 100 characters. Check the current Google documentation for the exact limits, because they change.
Parameters belong to the event that carried them. If you send value with generate_lead, that value does not appear on a later page_view.
How an event travels
The browser does not send data straight into a report. Each event passes through several stages, and a problem at any stage causes missing or wrong numbers.
Realtime and DebugView show events within seconds. Standard reports can take 24 to 48 hours to settle. This difference matters when you test. A missing event in a standard report on the same day does not prove that it is broken. Chapter 12 covers testing in detail.
Four kinds of events
GA4 groups events by who defines them. This affects how much work you must do and how much you can rely on the naming.
- Automatically collected events. GA4 sends them once the tag is installed. Examples are
first_visit,session_start, andpage_view(the last one is sent through the base configuration). - Enhanced measurement events. These are switched on in the data stream settings. Examples are
scroll,click(outbound links),file_download, andvideo_start. - Recommended events. Google defines the names and parameters, but you must send them yourself. Examples are
generate_leadandpurchase. - Custom events. You choose the name and the parameters. Use these when no recommended event fits.
Recommended events are worth using when one fits, because standard reports and Google Ads integrations know their parameter names. The next chapter compares the four types in more detail.
Sending an event
Here is the smallest useful example. It sends a recommended event with two parameters, using gtag.js.
// Fire after a lead form is successfully submitted
gtag('event', 'generate_lead', {
currency: 'USD',
value: 25.00
});The first argument, 'event', tells gtag that you are sending an event. The second is the event name. The third is an object of parameters. Here currency and value describe the estimated worth of the lead.
Two details matter later:
valuemust be a number, not a string.25.00works."$25.00"does not, because the currency symbol makes it unusable as a number.currencymust be a three-letter ISO 4217 code such asUSDorEUR. If you sendvaluewithoutcurrency, revenue-style reporting for that event can be wrong or missing.
The same event through Google Tag Manager
If the site uses Google Tag Manager (GTM), you usually do not call gtag directly. The page pushes a message to the dataLayer, and a GA4 event tag in GTM turns it into a GA4 event.
window.dataLayer = window.dataLayer || [];
dataLayer.push({ ecommerce: null }); // clear the previous ecommerce object
dataLayer.push({
event: 'purchase',
ecommerce: {
transaction_id: 'T_12345',
value: 59.98,
currency: 'USD',
items: [
{ item_id: 'SKU_123', item_name: 'Trail Shoes', price: 59.98, quantity: 1 }
]
}
});The first push sets ecommerce to null. This clears any ecommerce data left from an earlier push, because the data layer merges objects and old values can otherwise leak into the new event. The second push carries the event name in the event key, and a GTM trigger listens for that name. The GA4 event tag then reads the ecommerce object and sends it to GA4.
Parameters become useful only after you register them
Sending a parameter does not make it appear in reports. This is a common surprise.
- Some parameters are built in.
value,currency,transaction_id, anditemsare used by the standard ecommerce reports without further setup. - Custom parameters, for example
form_name, are collected but stay hidden in standard reports until you register them as a custom dimension or custom metric in Admin.
Registration applies from that point on. It does not fill in older data. If you plan to report on form_name, register it before you launch the form tracking, not after.
Registered dimensions count against property limits. A standard property allows 50 event-scoped custom dimensions and 50 custom metrics. Do not register every parameter you send.
Why this matters for key events
Marking an event as a key event needs only the event name. It does not need any parameters. However, a lead or sale is much more useful with them:
| Parameter | Why it matters for key events |
|---|---|
| `value` | Lets you compare the worth of leads and sales |
| `currency` | Lets GA4 read the value as money |
| `transaction_id` | Helps GA4 avoid counting the same order twice |
| `items` | Shows which products were sold |
Edge cases and common errors
- Name typos split your data.
generate_leadandgenerate-leadare different events. Only one of them is the recommended event, and only one of them might be marked as a key event. - An event must exist before you can mark it. In Admin, the key events list shows only events that GA4 has already received, unless you add the name manually. Send a test event first.
- Parameters are per event. A
valueset on a button click does not carry over to the later form submission. - Personal data does not belong in parameters. Do not send email addresses, phone numbers, or names. Google's policies forbid it, and the data is hard to remove once collected.
- Sampling and thresholds can hide small numbers. Reports that include Google signals may hide rows with very low counts. A low figure in a report does not always mean that few events happened.
- Events sent before consent may be dropped or modelled. Depending on your consent setup, some events may not be fully recorded. A later chapter covers this.
Summary of the model
- Everything is an event, and an event is a name plus parameters.
- The name decides what you can mark as a key event.
- Parameters such as
value,currency, andtransaction_idcarry the detail. - Custom parameters must be registered before they appear in reports.
- Realtime and DebugView show data quickly. Standard reports are slower.
Exercise
A developer sends gtag('event', 'Generate_Lead', { value: '$25', currency: 'USD' }); and the key event you marked as generate_lead shows zero results. Name two problems in the call and say how to fix each.
Show answer
First, the event name is Generate_Lead, but event names are case sensitive, so GA4 records it as a different event from generate_lead. Change it to the lowercase name. Second, value is the string '$25', which is not a number. Send 25 (or 25.00) and keep the currency in the separate currency parameter.
Exercise
You send a custom parameter form_name with every lead event. Two weeks later you look for it in a standard report and cannot find it. What step is missing, and will the fix show data from the past two weeks?
Show answer
The parameter must be registered as an event-scoped custom dimension in Admin. Registration only applies to data collected after you register it, so the past two weeks will not show the dimension, and only new events will.