Track Clicks on Sale Items

You can create an experience that tracks clicks or other interactions with products on sale on your site by creating a custom event in Event Builder to track these clicks. This use case includes creating a custom event and then adding it to an experience to track clicks on sale items on a retailer's site.

Creating the Custom Event

Click COMPONENTS in the top navigation bar, select Events, and then click CREATE EVENT.

Callout of the CREATE EVENT button on the Events list page

The client navigates to an index page or a search page that contains products tagged with a "Sale" badge.

View of Event Builder launched on a product category page on which a product has the 'Sale' badge

In Event Builder click Click on the Interaction tab.

Callout of the Click option on the Interaction tab of Event Builder

Find the element selector. The client clicks one of the product containers on the page to get the rough selector to be refined on the Details tab.

View of the Element Selector tool in Event Builder

The client launches Chrome's Developer tools to find the element needed for the event.

Callout of the Inspect option in the contextual menu to launch Google Chrome's Developer tools

The Developer tools reveals that the class need is product-card.

Expanding the code in Developer tools reveals the element product-tag of the class product-card.

Callout of the product-tag element that contains the Sale badge

The event should count this element only if it contains the text "Sale." With that said, the selector must be written to find the class product-card if it has the element product-tag that contains the text "Sale." Therefore, the selector is as follows:

.product-card:has(.product-tag:contains(Sale))

View of the Element Selector tool with the revised selector in the field and with a callout of the forward arrow

Click the forward arrow to move to the Details tab, on which the selector now appears in Element. To test the selector is accurate, press and hold the Shift key, click an element, and then verify that the click count increases when clicking an item that has the "Sale" badge.

Callout of a product entry that has a 'Sale' badge and callout of the click count in Event Builder

Click the forward arrow to move to the Conditions tab. This event should only track on index and search pages, so it requires an action condition. Click ADD CONDITION, expand Page type, and then select Page type =. The client completes the first action condition by typing index into the field. Repeat the process to create a second Page type = action condition, this time with search as the value. Because this event should track on index pages or on search pages, click to change the logic from AND to OR.

view of the Conditions tab with the 'Page type equals' option selected from the 'Page type' category of the ADD ACTION selector

Click the forward arrow. Give the event a title (for this use case, the event title is "Track Sales Clicks") and a description, and then click CREATE & EXIT.

Callout of the Title field, the Description field, and the CREATE & EXIT button

Configuring the Experience

Create a new experience. Click WHY, select To serve everyone the same experience and then click NEXT.

Callout of the WHY settings, the 'To serve everyone the same experience' option, and the NEXT button

Select a goal metric and then click NEXT.

Callout of the goal metric options and the NEXT button

Click ADD METRIC.

Callout of the ADD METRIC button

Select the click event built in Event Builder (in this use case, Track Sale Clicks), and then click CHOOSE SELECTED.

View of the Add Metrics modal, with a callout of the CHOOSE SELECTED button

Make any additional adjustments to the secondary metrics as necessary, and then click NEXT.

Callout of the NEXT button for the secondary metrics configuration

Confirm that you've configured the WHY settings as required and then click SAVE.

Callout of the SAVE button for the WHY settings configuration

The experience for this use case targets all visitors, so the WHO settings require no changes.

This experience collects data on the client's site and doesn't make any actual changes. Therefore, it uses the Data Collect action. Click WHAT, click ADD ACTION, click Other, and then click Data Collect. The action requires no action conditions, so click CREATE to finish adding the action to the experience.

View of the Data Collect action template with a callout of the CREATE button

Activating the Experience

Because you test the event when creating it in Event Builder and the experience only collects data, the experience requires no further quality assurance testing. Click ACTIVATE.

Callout of the ACTIVATE button