Sub topic 4
Building your first audience with conditions and groups
This chapter assumes you have a GA4 property that collects data, you know events, event parameters, and user properties, and you have Editor or Administrator access. You will build one audience from start to finish: users who added an item to their cart but did not purchase. You will see how conditions and groups combine, where the evaluation scope fits in, and what to check after you save.
What the builder evaluates
An audience is a saved set of rules. GA4 tests each user's recorded events and user properties against those rules. A user who matches joins the audience and stays in it for the membership duration. The rules are built from three kinds of input:
- Events, such as
add_to_cartorpurchase, optionally with a count. - Event parameters, such as
currencyorplan_name, attached to a condition on an event. - User properties and built-in dimensions, such as
membership_tier, country, or device category.
Parameters and user properties that are not built in must be registered as custom dimensions before you can filter on them. The previous chapter covered this. An unregistered parameter will not appear in the picker.
Send an event the audience can match
For the example audience you need an event to match. The standard add_to_cart event with its recommended parameters works well.
gtag('event', 'add_to_cart', {
currency: 'USD',
value: 29.99,
items: [{ item_id: 'SKU_123', item_name: 'Trail Shoes', price: 29.99, quantity: 1 }]
});Confirm in Admin > Data display > Events, or in DebugView, that add_to_cart and purchase arrive before you build anything. An audience cannot match an event GA4 never received.
Open the builder
- Go to Admin, then Data display, then Audiences.
- Select New audience.
- Choose Create a custom audience. You can also start from a template or suggestion, which a later chapter covers.
- Under "Include users when", select Add new condition.
The builder shows a list of choices: events, dimensions, metrics, and segments. Pick Events, then add_to_cart.
Conditions and condition groups
A condition is one test, such as "the user triggered add_to_cart". A condition group is a container for conditions that must hold together. The combination rules are:
- Conditions inside the same group are combined with AND.
- Separate groups are also combined with AND. The user must satisfy every include group.
- An exclude group removes users who match it, no matter what the include groups say.
Where the interface offers an OR option on a condition, you can use it to accept alternative values. For many alternatives on one field, a single "matches regex" filter (for example premium|enterprise) is often easier than stacking conditions.
Add a parameter filter
You can narrow an event condition with parameters. After you select add_to_cart, choose Add parameter. Pick currency, set the operator to "exactly matches", and enter USD. The condition now means "triggered add_to_cart with currency equal to USD".
You can also filter on the event count. For example, "event count is at least 2" finds users who added to cart twice or more. Each filter you add narrows the condition further.
Custom parameters work the same way, once registered. This event carries a plan_name parameter:
gtag('event', 'select_plan', {
plan_name: 'pro',
billing_period: 'annual'
});After you register plan_name as an event-scoped custom dimension, an audience condition can require select_plan with plan_name equal to pro. The condition only sees events collected after registration, so give it time to accumulate data.
Filter on a user property
A user property describes the person, not one action. Set it once and GA4 attaches it to later events.
gtag('set', 'user_properties', {
membership_tier: 'premium'
});Register membership_tier as a user-scoped custom dimension. Then, in the builder, choose Add new condition, then Dimensions, then your custom dimension, and set it to match premium. This kind of condition checks an attribute rather than an event. It is useful for audiences like "premium members who have not visited in 30 days".
Build the cart abandoners audience
- Add a condition for the event
add_to_cart. This is the first include group. - Give the audience a name that states its logic, such as
Cart abandoners 7d. - Select Add group to exclude, then choose the event
purchase. - Set the exclusion scope so it applies to the same time frame you intend to target. The next chapters cover scope in detail.
- Set the membership duration (see below).
- Save the audience.
The result is: users who triggered add_to_cart, minus users who triggered purchase.
Scope in one paragraph
Each condition is evaluated at one of three scopes: within the same event, within the same session, or across all sessions. Within the same event requires every filter to match on a single event. Within the same session requires the conditions to occur in one visit. Across all sessions lets them occur at any time in the user's history within the lookback. Choose the narrowest scope that matches your intent. Putting currency = USD and value > 20 in one event-level condition is not the same as two separate conditions that could be met by different events.
Membership duration
Membership duration sets how long a user stays in the audience after they last meet the conditions. The default is 30 days. The maximum is 540 days. If the user meets the conditions again, the clock restarts.
Match the duration to the buying cycle. A short window of 3 to 7 days suits impulse purchases and cart reminders. A longer window of 30 to 90 days suits considered purchases. Very long windows keep users who are no longer relevant and can inflate the list.
After you save
GA4 evaluates new audiences going forward and may include some recent history. It can take up to 24 to 48 hours before the audience shows users. Open the audience list and look at the user count and the trend. An empty audience after two days usually means one of these:
- A custom dimension was registered after the data arrived.
- Two conditions that can never be true together were put in the same event-scoped group.
- The event name has a typo, since event names are case sensitive.
- The exclusion matches every user because of its scope.
Check your understanding
Exercise
You build an audience with two include groups: group 1 requires the event view_item, and group 2 requires the event add_to_cart. A user triggered only view_item. Is the user in the audience, and how would you change it so the audience matches users who did either?
Show answer
No. Separate include groups are combined with AND, so the user must meet both groups. To match either event, use an OR option on the condition if the builder offers it, or restructure the rules. Alternatively, create two audiences, one per event.
Exercise
Your Cart abandoners audience has been empty for three days. List two things you would check first.
Show answer
Check that add_to_cart and purchase are arriving in GA4 with exactly the expected names, using DebugView or the Events report. Then check whether any parameter or user property used in a condition was registered as a custom dimension, and whether the exclusion scope is excluding everyone.