Sub topic 2
Sending parameters and user properties
This chapter assumes you know what a GA4 event is, can open Admin in a GA4 property, and can add a tag with gtag.js or Google Tag Manager (GTM). You will send extra details with events, check them, register them, and create a custom metric.
Sending event parameters
An event parameter is a named value attached to one event, such as plan_tier: 'pro'. Send it in the third argument of gtag('event', ...):
gtag('event', 'select_plan', {
plan_tier: 'pro',
billing_cycle: 'annual'
});A user property describes the user rather than one event. Set it once, and GA4 attaches it to later events from that user:
gtag('set', 'user_properties', {
customer_type: 'subscriber'
});Checking your data in DebugView
Open the site with debug mode on, for example by adding debug_mode: true to an event or by using the Google Analytics Debugger extension. Then open Admin > DebugView. Select an event and confirm that each parameter appears with the value you expect.
> Note: Check the spelling and casing of each parameter name now. Registration uses the exact name.
Registering a custom dimension in Admin
GA4 does not show a parameter in reports until you register it. Registering a dimension has these steps:
- Open Admin > Data display > Custom definitions.
- Select Create custom dimension.
- Enter a dimension name, choose a scope, and enter the parameter name exactly as sent.
| Scope | Use it for | Example parameter |
|---|---|---|
| Event | One event's details | `plan_tier` |
| User | Stable traits of a user | `customer_type` |
| Item | Fields inside the items array | `item_color` |
Registration applies only to data collected after you save it. GA4 does not add past data.
Creating custom metrics and choosing units
A custom metric turns a numeric event parameter into a measure you can sum or average. Open Custom definitions, select Create custom metric, choose the event parameter, and select a unit of measurement such as Standard, Currency, or Seconds. The unit controls how reports format the number, so choose the one that matches what the parameter stores. Custom metrics also apply only to new data.
Exercise
Exercise
You send billing_cycle: 'annual' with a select_plan event. Which scope should you choose for a custom dimension that reports this value, and why?
Show answer
Event scope, because the value describes one select_plan event and can change with each event.