---
title: Create an Audience with Dynamic Variables
slug: ikea-summer-2025-hol/create-an-audience-with-dynamic-variables
docTags: 
createdAt: 2023-12-14T10:23:56.102Z
---

Dynamic segmentation solves the scalability problems marketers traditionally face when building audiences for marketing campaigns.&#x20;

Unlike static segmentation which requires you to explicitly capture every possible use case, dynamic segmentation uses variables to build the rule logic and dynamically express relationships.

# Create dynamic audience

## Add events

So, we are going to define an audience for profiles that have: **Viewed a product, AND NOT purchased this same product in the last 24 hours**.

- Click on **+ Create Audience**. This will open the Create Audience popup;
- Select **Build Rule&#x20;**&#x61;s the create method. This will open the Rule Builder.&#x20;
- Select the **Events** tab in the Fields section.
- Search for **Product Views**
- Drag the **Product Views,&#x20;**&#x66;rom th&#x65;**&#x20;Event Type&#x20;**&#x73;ection, onto the Audience Builder Canvas.

![](https://api.archbee.com/api/optimize/1Jp0iolWv35Z_mkI7oUiT/sAB4D9gVD5Dc_Uku9YBW__image.png)

Now we want to add a second condition to look for profiles who have NOT purchased a product:

- select the **Events** tab in the Fields section;
- search for **Purchases**;
- drag the **Purchases** Event Type onto the Audience Builder Canvas, beside the **Product Views**.

Your audience definition should look like:

![](https://api.archbee.com/api/optimize/1Jp0iolWv35Z_mkI7oUiT/GpLLvZQ-42kNxt0GIfJlE_image.png)

## Add time constraint

To restrict the time period between product views and purchases:

- select the clock icon between the two events;
- select the `Within` checkbox;
- specify `1 Day(s)`;
- click the clock icon again to close.

![](https://api.archbee.com/api/optimize/1Jp0iolWv35Z_mkI7oUiT/WnrEP35D_S-O5_ADxtA-6_image.png "Time between events.")

## Add dynamic variables

:::hint{type="warning"}
**IMPORTANT**: for the next part of the exercise DO NOT use the search feature, but find manually the attributes needed.
:::

Now we want to add a third condition that will ensure audience qualification only occurs when the two events reference the same product.

This is our **Dynamic Variable**.

- Click on the **Purchases** event to ensure the event is highlighted (blue border around the card in the canvas);

![](https://api.archbee.com/api/optimize/1Jp0iolWv35Z_mkI7oUiT/b5vh3nDzDLDco-SKqSWl7_image.png)

- select the **Events** tab in the Fields section;
- clean the search text field (in case you have some characters left)
- from the Browse variables (the section below Event Types), select **Purchases >**;
- select **Product list items >**;
- select **Name**;
- drag **Name** onto the Audience Builder Canvas, in the Event Rules section, where it says **Add event field**.

![](https://api.archbee.com/api/optimize/1Jp0iolWv35Z_mkI7oUiT/O2XeDpfdb8ol1xNyrH1Rw_screen-recording-2023-12-19-at-101742.gif)

Your audience should look like:

![](https://api.archbee.com/api/optimize/1Jp0iolWv35Z_mkI7oUiT/ZidjhBS8TprVuRI-EFbf-_image.png)

We need to compare the product name of the Purchases event to the product name of the Product Views event.&#x20;

Navigate back to the root of the XDM schema (see the video below).

![](https://api.archbee.com/api/optimize/cPBDqdbhvFSQWFNnID7Bn-wY0kwBIw84Yx7z1QWrbHb-20241108-123022.gif)

Then:

- select the **Events** tab in the Fields section;
- from the **Browse variables**, select **Product Views >.**

![](https://api.archbee.com/api/optimize/1Jp0iolWv35Z_mkI7oUiT/frBNql_akiVgtF-rWvup6_image.png)

- select **Product list items >**;
- select **Name**;
- drag **Name** onto the Audience Builder Canvas in the **Event Rules** section, into the "Equals" condition text box; as you drag the Product Name over the text box you'll be given the option to **Compare Operands**;
- drop **Name** into this area.

![](https://api.archbee.com/api/optimize/1Jp0iolWv35Z_mkI7oUiT/XYhFEQXLPtU-JlXJRHO_-_screen-recording-2023-12-19-at-103203.gif)

We want to the Purchase event to be an **Exclusion** rule. To change this:

- click on the Purchase event;
- in the Event Rules, select the **Include** drop down and change this to **Exclude**.

Your audience definition should look like:

![](https://api.archbee.com/api/optimize/1Jp0iolWv35Z_mkI7oUiT/PlvqUho-gPOzY1VqVB8BM_image.png)

Finally, let's save our audience.

- Enter a **Name** for your audience using the following naming convention
  `[your name] - Viewed Product, did not purchased in the last 24 hrs `,&#x20;
  e.g. `angeli - Viewed Product, did not purchased in the last 24 hrs`.
- (optional) Enter a **Description**.
- Select **Batch** from the **Evaluation method** dropdown list.
- Click on **Publish**.

