[Bonus] Dynamic variables
Dynamic segmentation solves the scalability problems marketers traditionally face when building audiences for marketing campaigns.
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.
So, we are going to define a segment for profiles that have: Viewed a product, AND NOT purchased this same product in the last 24 hours.
- In the menu on the left side, click on Audiences;
- click on + Create Audience. This will open the Create Audience popup;
- select Build Rule as the creation method. This will open the Rule Builder;
- select the Events tab in the Fields section;
- search for Product Views;
- Drag the Product Views, from the Event Type section, onto the canvas.

Now we want to add a second condition to look for profiles who have NOT purchased a specific product:
- select the Events tab in the Fields section;
- search for Purchases;
- drag the Purchases Event Type onto the Segment Builder Canvas, beside the Product Views.
Your segment definition should look like:

To restrict the time period between product views and purchases:
- click on the clock icon between the two events;
- select the Within checkbox;
- specify 1 Day(s);
- click the clock icon again to close the popup.

As a next step, we want to add a third condition to ensure that segment qualification only occurs when the two events refer to 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);

- select the Events tab in the Fields section;
- from the Browse variables section, select Purchases >;
- select Product list items >;
- select Name;
- drag Name onto the Segment Builder Canvas, in the Event Rules section, where it says Add event field.

Your segment should look like:

We need to compare the product name of the purchase event to the product name of the Product View event.
To do this:
- select the Events tab in the Fields section;
- click on the black folder icon;
- click on Variables; this will bring you back to the root folder;

- from the Browse variables, select Product Views >.

- select Product list items >;
- drag Name onto the Segment 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 the Name into this area.

We want the Purchase event to be an Exclusion rule. To change this:
- click on the Purchases event;
- in the Event Rules, click the Include drop down and change this to Exclude.
Your segment definition should look like:

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 , e.g. sacker - Viewed Product, did not purchased in the last 24 hrs.
- (optional) Enter a Description.
- Select Batch from the Evaluation method dropdown list.
- Click on Save and Close.