Sub topic 5
Recommended events: predefined names and parameters
What recommended events are
A recommended event is an event whose name and parameters Google has already defined, but which GA4 does not collect on its own. You have to send it from your site, app, or server. Google publishes the list by vertical: all properties, online sales, games, and so on.
This chapter assumes you know what an event and an event parameter are, can read a JavaScript object, and have gtag.js on your site. Later chapters cover custom events, the naming rules, Tag Manager, and validation.
Recommended events are different from the other categories you have met:
- Automatically collected events, such as
first_visitandsession_start, need no code. - Enhanced measurement events, such as
scrollandfile_download, are switched on in the data stream settings. - Custom events use names you invent.
Why use a recommended event
GA4 recognizes the names and parameters in the recommended list. That recognition gives you three things.
- Built-in reports. Reports and explorations are built around names like
purchaseandadd_to_cart. Monetization reports, for example, readpurchasealong with itsvalue,currency, anditems. - Predefined fields. Parameters such as
items,value, andcurrencyare already known to GA4. Theitemsfields (item_id,item_name,price,quantity) appear as item-scoped dimensions without extra registration. - Future features. Google adds features that depend on these names. A custom event with a similar name gets none of this.
The trade-off is that you must follow the specification. A misspelled name, such as Purchase or purchased, is treated as a different custom event. GA4 will not warn you.
A simple example: login
login is one of the simplest recommended events. Its recommended parameter is method, which says how the user signed in.
gtag('event', 'login', {
method: 'Google'
});The first argument, 'event', tells gtag this is an event hit. The second is the event name, exactly as Google spells it. The third is an object of parameters. method is recommended, not required. Still, sending it lets you compare sign-in methods in reports once you register it as a custom dimension (covered in a later chapter).
A richer example: purchase
purchase is the most important recommended event for online stores. It carries ecommerce data.
gtag('event', 'purchase', {
transaction_id: 'T_12345',
value: 59.98,
currency: 'USD',
items: [
{
item_id: 'SKU_123',
item_name: 'Trail Shoes',
price: 29.99,
quantity: 2
}
]
});Each field has a job:
| Parameter | Type | Purpose |
|---|---|---|
| `transaction_id` | string | Identifies the order. GA4 uses it to avoid counting the same purchase twice. |
| `value` | number | The monetary value of the event. Here it is 2 × 29.99 = 59.98. |
| `currency` | string | A three-letter ISO 4217 code such as `USD`. |
| `items` | array of objects | The products involved. Each needs `item_id` or `item_name`. |
Two details matter in practice.
valueneedscurrency. If you sendvaluewithoutcurrency, revenue is not reported correctly. Send both whenever you send a monetary value.valueis not computed for you. GA4 does not add upprice × quantityfromitems. You calculatevalueand send it. Decide up front whether it includes tax and shipping, and apply that rule consistently. Document the decision in your tracking plan.
How recommended events are grouped
Google lists recommended events by business type. The table shows a few common ones.
| Group | Example events | Typical parameters |
|---|---|---|
| All properties | `login`, `sign_up`, `share`, `search` | `method`, `search_term` |
| Online sales | `view_item`, `add_to_cart`, `begin_checkout`, `purchase`, `refund` | `items`, `value`, `currency`, `transaction_id` |
| Lead generation | `generate_lead`, `qualify_lead`, `close_convert_lead` | `value`, `currency` |
| Games | `level_up`, `unlock_achievement`, `post_score` | `level`, `achievement_id`, `score` |
Check the current official list before you build. Google adds and revises recommended events, and the table above is a sample, not a full reference.
You do not need to send every event in a group. Send the ones that match steps your users actually take. A store might send view_item, add_to_cart, begin_checkout, and purchase, and skip share.
The ecommerce flow
Ecommerce events form a sequence. Each one adds to the picture of how users move toward a purchase.
Because these names are recognized, the checkout and shopping behavior reports can show where users drop out. With custom names for the same steps, you would have to build that funnel yourself in an exploration.
Sending from the server
A recommended event does not have to come from the browser. You can send it from a server with the Measurement Protocol, which is useful when the action happens out of sight, such as a confirmed sign-up. The event name and parameters follow the same rules.
POST https://www.google-analytics.com/mp/collect?measurement_id=G-XXXXXXXXXX&api_secret=API_SECRET
Content-Type: application/json
{
"client_id": "CLIENT_ID",
"events": [
{
"name": "sign_up",
"params": {
"method": "email"
}
}
]
}The request needs a measurement ID, an API secret created in the data stream settings, and a client_id that ties the hit to a browser user. Use the same client_id the browser used, or the server event will look like a different user. The Measurement Protocol is meant to supplement browser or app tagging, not replace it.
Common errors
- Wrong name or case. Event names are case-sensitive.
Add_To_Cartis a custom event, notadd_to_cart. - Wrong types. Sending
value: "59.98"as a string can lead to values not being read as numbers. Send numbers as numbers. - Missing
currency. Revenue appears as zero or is dropped. - Duplicate purchases. Firing
purchaseon every reload of a confirmation page inflates revenue. Keeptransaction_idunique per order, and avoid refiring the event when the page is refreshed. - Inconsistent
items. If one event usesitem_id: 'SKU_123'and the next usesitem_id: '123'for the same product, item reports split into two rows. - Assuming parameters are reportable. Standard ecommerce fields are available in reports. Parameters such as
methodneed a registered custom dimension before you can break down reports by them.
When no recommended event fits
If nothing in the list describes the interaction, use a custom event rather than stretching a recommended one. The next chapter covers this. A custom event for a newsletter button, for example, might look like this:
gtag('event', 'newsletter_signup_click', {
placement: 'footer',
plan_type: 'free'
});The rule of thumb: when a recommended event describes the action, use it with its recommended parameters. Otherwise, send a custom event with a clear name.
Exercise
A store sends gtag('event', 'purchase', { transaction_id: 'T_900', value: 40, items: [{ item_id: 'SKU_9', quantity: 2, price: 20 }] });. Name two problems or risks with this call and say how to fix them.
Show answer
First, currency is missing, so GA4 cannot report the 40 as revenue correctly. Add currency: 'USD' (or the correct ISO 4217 code). Second, check that value is meant to equal price × quantity (2 × 20 = 40). That works here, but the team must decide whether tax and shipping are included and apply the rule every time. Also, item_name is absent. item_id alone is allowed, but adding item_name makes item reports easier to read. To avoid duplicates, the page should not refire the event on reload.
Exercise
A developer sends gtag('event', 'Add_To_Cart', { ... }) with correct ecommerce parameters. Will GA4 treat it as the recommended add_to_cart event? Why or why not?
Show answer
No. Event names are case-sensitive, so Add_To_Cart is a different name and is collected as a custom event. Built-in ecommerce reports that rely on add_to_cart will not include it. Rename it to add_to_cart.