Event tracking is the practice of recording specific actions people take on a website or app: a form sent, a file downloaded, a video started, a button clicked. Each action is stored as an event with a name and some details, so you can count it, compare it across pages and traffic sources, and see what leads to it.
Without events, an analytics tool mostly knows which pages people viewed. With events, you can see what they did there.
How events work in Google Analytics 4
In Google Analytics 4, everything is an event, even a page view. Each event has a name and up to 25 parameters that describe it:
gtag('event', 'generate_lead', {
form_name: 'demo_request',
page_type: 'pricing'
});
GA4 sorts events into four types. The first two need no code. The other two you set up yourself:
| Type | What it is | Examples |
|---|---|---|
| Automatically collected | Recorded as soon as GA4 is installed | session_start, first_visit |
| Enhanced measurement | Recorded when you switch it on in the data stream settings | scroll, click (outbound), file_download, form_submit |
| Recommended | You add them, but Google defines the names and parameters | sign_up, login, generate_lead, purchase |
| Custom | Names and parameters you define | pricing_toggle, calculator_used |
Check the first three before you invent a custom event. Google's own names fill reports that custom events don't.
If you learned event tracking in Universal Analytics, its category, action and label fields are gone; standard Universal Analytics properties stopped processing data on July 1, 2023. Other tools still use that shape. Matomo, for example, records a category, an action, an optional name and an optional value.
Plan your events before you tag anything
A short tracking plan saves you from a report full of events nobody uses.
- Start with questions. "Which blog posts lead to demo requests?" needs a lead event with the page it happened on. "Do people finish the pricing calculator?" needs a start and a finish event.
- Pick names. Use a recommended name where one fits. Otherwise use short, lowercase names with underscores, and stay under GA4's 40-character limit. Names are case sensitive, so
Sign_Upandsign_upare two different events. - Pick parameters. Add the details you'll want to filter by, such as the form name or the plan chosen. Keep values under 100 characters.
- Register what you'll report on. Parameters only show up in GA4 reports after you create a custom dimension or metric for them.
- Mark key events. Flag the few actions that matter most to your business, such as a purchase or a lead, as key events. A standard property allows up to 30. GA4 used to call these conversions; "conversion" now means an action measured for Google Ads bidding.
Add the tracking
There are two common ways to send events from a website:
- In the site's code, with
gtag('event', …)calls like the example above. This suits events that developers already know about, such as a completed checkout. - With Google Tag Manager. You set triggers, such as a click on a certain button, in a web interface. Marketers can add and change events without a release.
Don't send personal data. Google's help for enhanced measurement says you're required to make sure no personally identifiable information is collected. That means no email addresses or names in event parameters or page URLs. Where privacy law requires consent, your tags have to respect each visitor's choice; see consent mode.
Check that events arrive
Test every event before you trust its numbers:
- Realtime report. Shows events from the last 30 minutes, with a count per event name.
- DebugView. Shows every event from one test device, with all its parameters, once debug mode is on.
Then trigger the action yourself: send the form, download the file. Check that the event appears once, with the parameters you expected. If it shows up twice, look for the same action tagged both in the code and in Tag Manager.
How event tracking helps SEO
Search tools show you what happens before the click. Events show what happens after it:
- Which organic landing pages lead to key events. That's how you tell a post that brings traffic from one that brings customers.
- Whether people read. GA4's
scrollevent fires when someone reaches 90% of a page's depth. A page with lots of search traffic and few scrolls may not answer the query. - What people search for on your site. The
view_search_resultsevent records internal site searches. Terms people search for often, that no page answers well, point to content gaps.
For the bigger picture of reading this data, see web analytics and attribution modeling.