When testing in e-commerce sites, the opportunity might arise to test certain changes only on products of a certain price, over a certain price, or under a certain price.
This will trigger the experience only on pages that match the price condition that you set.
First, you need to make sure that Page Tags have been implemented with the _conv_product_price variable.
- Targeting products that match an exact price:
In this example, we are going to target product pages over 25. Go into the Locations and create and create a condition like the following:
- Targeting products over or under a certain price:
Create a JS Condition like the following, adjusting the comparison operator to what you need, < (less than) or > (greater than):
location.href.includes('products') && _conv_product_price < 25
- Targeting products based on a another price, besides the standard price, such a discounted price.
Sometimes we need to target prices based on a discounted price. In this case, you need to either map the _conv_product_price variable to the discounted price, or you can also target the price based on the element displayed in the product page.
Here is an example:
products/') && document.querySelector('. price--highlight'). textContent.replace(/\$/g,'') < 25
In this example, we are targeting the element with the CSS selector '.price--highlight'.
You can learn how to create a selector.