What is Product History Targeting?
Product History Targeting allows users to target customers based on products that they have viewed, added to basket or purchased. The information that we collect can be stored and used for up to one year.
How to set up Product History Targeting
Unlike most features available in YCP that are readily available without the need for being set up, Product History Targeting requires some work before being utilised on your clients website.
PHT requires us to set up the correct variables and repeated items that we would like to target on.
Variables - Allows the user to target on products Viewed
Repeated Items - Allows the user to target on products Added to Basket and Purchased.
Therefore it is important that both of these are set up correctly.
Variable Mapping
To set up and target on a Variable, press the Website Mapping CTA on the main menu and then select the 'Add Variable' option on the page. For this example we will map the Product Name.
Once you have pressed Add Variable, you will be required to complete some important information. The most important for PHT are:
Name - The Name dropdown allows you to select the variable you want to be able to target on for Viewed. We recommend using anything located within the Product section of the dropdown.
Data Type - This is the type of data you are collecting. In this case, because we want to map Product Name, that is text, therefore we would select String. For numerical data, we would want to select Integer or Float.
Persist - Whether we want to collect data per session or cross-session.
Target under Product History - Whether you want to use this variable for Product History Targeting.
Product History ID - Product History requires an ID. This will automatically be assigned to the first variable that you want to target for product history, however it can be changed when others are added if you need to select a more suitable ID.
Target Description - A comment option to allow you to describe what this variable does or instructions for targeting. For example, case sensitivity is required.
The next requirement is to tell the platform how you plan on scraping that information. To do this, press the 'Add Source' CTA.
Once you have pressed Add Source CTA, you will once again be required to complete some important information for PHT.
Type - The type is the method you will use to gather the data
Page - The page in which the data is located. This will either be Product, Cart or Confirmation pages.
Selector - The CSS selector of the data you which to scrape
Regex - Regular expressions (shortened as "regex") are special strings representing a pattern to be matched in a search operation.
Finding the Selector
To find the Selector which you would like to scrape, navigate to the Page type where your variable would be located, in this case Product Name, highlight that name, right click and select Inspect.
You will then be able to find the name of the CSS selector in the console on the right hand side as you hover down the CSS. We want to take note of the CSS product_name and insert this into the Selector section.
It is essential that the CSS Selector that we insert is accurate as there is currently no way within the platform to get feedback if it is not correct. If the Selector is inputted correctly, the variable will be targetable however we will not be gathering any data and therefore will provide a negative experience. When the selector has been defined, we should test it using the debugger.
To test the Selector is working as intended, navigate to the client websites product page and at the end of the url insert /#yidebug. This will open the debugger. If the Variable and the Selector are mapped correctly, then you should see the Variable name present and the data that has been scraped. In this case we have viewed the product named 'Beanie' as seen above. If this is blank after inserting a Selector, then the Selector is incorrect.
When you complete all the necessary details required for mapping the Variable for PHT, you will notice that the variables are tagged for product history targeting. We also added Product Price and Product breadcrumb to our variables, with Product Name as our ID.
Targeting on Product History Variable
As we have correctly mapped the variable for PHT, we are now able to target users who view certain products, and in the example below you can see that Name, Price and Breadcrumb are now targetable options on the targeting page.
We now want to create a strategy where we can target customers who have viewed a Beanie in the last 1 day and offer those customers 10 percent off. Using the settings below will allow us to achieve this.
As you can see below, when a customer returns to the website, they are now presented with the 10% off Beanies notification.
Repeated Item Mapping
As mentioned above, we map variables to target on Viewed, however we also need to Repeated Item Mapping to target users based on products they have added to their basket or purchased. To set up and target on a Repeated Item, press the Website Mapping CTA on the main menu and then select the 'Add Repeated Item' option on the page. Again, we will map the Product Name.
Once you have pressed Add Repeated Item, you will be required to select the Name. At this point we want to select the option Basket Items.
Similarly to Variable mapping, we also require a Source for repeated item mapping so that we can tell the platform how you plan on scraping that information. To do this, press the 'Add Source' CTA once again.
Once you have pressed the Add Source button you will be required to complete some important information.
Page - The page in which the data is located. This will either be Product, Cart or Confirmation pages.
Selector - The CSS selector of the page you which to scrape. This differs slightly from variable mapping in that you need to map the CSS of the Page first and not the variable you are selecting.
After inputting Source details, we want to add a Property of the source. A property lets us define which attribute of the source we want to scrape and use for our targeting. To add a property, select the Add property CTA.
Once you have pressed the Add Source button you will be required to complete some important information:
Name - The Name dropdown allows you to select the repeated item attribute you want to be able to target on for Added to basket and Purchased.
Data Type - This is the type of data you are collecting. In this case, because we want to map Product Name, that is text, therefore we would select String. For numerical data, we would want to select Integer or Float.
Selector - The CSS selector within the defined Page selected above.
Regex - Regular expressions (shortened as "regex") are special strings representing a pattern to be matched in a search operation.
Target under Product History - Whether you want to use this variable for Product History Targeting.
Product History ID - Product History requires an ID. This will automatically be assigned to the first variable that you want to target for product history, however it can be changed when others are added if you need to select a more suitable ID.If the Variable is already mapped and selected as Product History ID, then this will automatically be selected.
To add more properties, simply click the add property CTA again. We will add Product Price as another property. Once you have filled in all necessary information, you can save.
When Variables and Repeated Items Product History ID do not match
When mapped Variables and Repeated Items Product ID do not match, we will be made aware in the platform through warning. This happens when the ID of a Variable is different than that of the Repeated Item. We should ensure that the product ID matches. Clicking into the Repeated Item will also display an error.
To make the error disappear, simply change the Product History ID back to that of the ID that matches the variable. In this case, we can see that Manufacturer has been chosen as opposed to Name.
When there are Product History Variables Mapped but no Repeated Items
The platform will also highlight for the user any discrepancies between mapped variables and repeated items. In this case, we have Product Breadcrumbs mapped as variable however we have not mapped it for repeated items. Clicking into Repeated Items will inform the user.
Targeting on Repeated Items
Once we have correctly mapped our attributes for Repeated Items, we should not be able to target on Added to Basket and Purchased. For this example, we created a campaign where we offered customers who purchased an item for £15 or more free delivery with their next order. As you can see below, we now have the option to target on all three of the options.
As you can see below, I place an order for a value of $36. When I next return to the website, I should see the new campaign targeted at me.