Introduction
Welcome! This article will provide you with a simple step-by-step guide to creating the different variables we can use : based on the context, the item or the user.
The variable allows us to adapt the tag according to each context we have. Instead of making many merchandising rules to different scenarios, the variable can do this automatically.
We will see the 3 ways to create these variables and in which context we can use them.
Prerequisites
Before we start, make sure you have access to the XO control panel and that your items feed is available in XO. If you do not have logins you can request access to an Admin user in your organisation.
If you don't know any admin user, the Support team can provide a list for you. You can open a request with us by clicking here and choosing “I/my colleague require access to an Attraqt service” from the use case drop down on the “Submit a request” page in the Support Centre.
Different kinds of variable:
The variable you create can be based on 3 different elements:
- Based on the context
- Based on the product
- Based on the user
First case: Variable based on the context
This variable will allow us to collect some information we don't have in order to use it in the merchandising rules. We can collect this information from different sources (mostly from the datalayer) and it has to be passed on the API call to be use in the merchandising rules.
For this step, all depends of the implementation mode. If the widget's triggering has been managed by the client, it has to be made by them. If the widget's triggering has been managed by XO, you can send us a request with the information you would like to have and in which widget.
For example, in the basket page, I would like to have the global amount on the basket, in order to make a price rule on it.
In this example, XO already took the information from the datalayer, named "basketAmount" and passed it on the API call, now we just have to create and configurate the variable.
Step 1
Go on the XO console, then in the 'Developers' menu, click on 'Variables'.
Click on 'Add a new variable' to create your first variable:
Step 2
Name your variable, you have to use the same wording than the source, here, it will be $basketAmount (a variable always begin with the $ sign, it's systematic).
Then, precise the type of variable you want to configurate (the next fields will adapt):
Step 3
Indicate the type of variable you want to have. In this example, we'll have an amount, so il will be "float":
Save the variable.
You can make some advanced setting, like putting a transformation or add a prefix.
It's not mandatory but it can be a good way to homogenize all the variables. To see the best way to use these advanced settings, you can read this article.
Application with a scenario
We would like to put the basket amount as maximum price on the merchandising, in order to not propose products more expensive that the global amount of my basket.
To do this, we just need to go to merchandising rules, on the price field and put the variable on the max one:
This way, the variable adapts to each context and put the basket amount as max price.
For example, if we have an amount of 20€ in the basket, all the recommended products will not cost more than 20€. If we're putting a new product which cost 10€, the variable will adapt the max price to 30€.
Warning: If your variable will collect a category, a brand or any wording in this type, you have to check that the information collected will well match with the product's tag. See this article for more information.
Second case: Variable based on the item
This variable will allow us to collect the information from the item attributes and use them on the merchandising.
For example, on the product page, we would like to boost the brand of the product. To do this, we'll need a variable which will collect the brand of each product we're looking.
Step 1
Go on the XO console, then in the 'Developers' menu, click on 'Variables'.
Click on 'Add a new variable' to create your first variable:
Step 2
Name your variable, it's better to use a wording easy to remember, like $product_brand (a variable always begin with the $ sign, it's systematic).
Then, precise the type of variable you want to configure (the next fields will adapt):
Step 3
You will have to put a source, the variable needs to know on what element it can be based to collect the information you need.
In this example, we will need the Id of the product we're looking in order to have its brand, so we can put the $productId.
Then, select the attribute you need:
Step 4
Indicate the type of variable you want to have. In this example, it will be a "string":
Save the variable.
You can make some advanced settings, like putting a transformation or add a prefix.
It's not mandatory but it can be a good way to homogenize all the variables. To see the best way to use these advanced settings, you can read this article.
Application with a scenario
On the product page, we would like to boost the brand of each product.
To do this, we just have to go to merchandising rules and put the variable on the boost field:
This way, the variable will adapt the brand according to the product we're seeing.
For example, if we're seeing an Iphone, we'll boost Apple brand, and if we're seeing a Galaxy phone, we'll boost Samsung brand.
Warning: If your variable will collect a category, a brand or any wording in this type, you have to check that the information collected will well match with the product's tag. See this article for more information.
Third case: Variable based on the user
This variable will allow us to collect some information about the user, in order to have more personalised recommended products.
These information can be based on many elements, but mostly on the activities we're tracking (view; click-on-reco; add-to-cart and buys).
For example, on the basket page, we would like to exclude the last 10 products bought by the client, in order to not propose products he recently bought.
Step 1
Go on the XO console, then in the 'Developers' menu, click on 'Variables'.
Click on 'Add a new variable' to create your first variable:
Step 2
Name your variable, it's better to use a wording easy to remember, like $user_last10buys (a variable always begin with the $ sign, it's systematic).
Then, precise the type of variable you want to configure (the next fields will adapt):
Step 3
You will have to put the attribute you want. In this example, we want to have the activities based on products, and more specifically on "buys":
Step 4
Then, you have to define the numbers of buys you want to collect. Here, it will be 10 but you can put every number you want.
After this, you just have to select the variable type and the list type. As you want to collect the last 10 buys, it will be a list of items (in order to no collect just one item):
Save your variable.
You can make some advanced settings, like putting a transformation or add a prefix.
It's not mandatory but it can be a good way to homogenize all the variables. To see the best way to use these advanced settings, you can read this article.
Application with a scenario
On the basket page, we would like to exclude the last 10 products bought by the client, in order to not propose products he recently bought.
To do this, we just have to go to merchandising rules and put the variable on the excluded items field (as the variable will collect some ids and not a tag, we're putting this on the items field on the right):
This way, with this variable, we can know the last 10 buys of each clients and exclude them from the basket page.
Warning: If your variable will collect a category, a brand or any wording in this type, you have to check that the information collected will well match with the product's tag. See this article for more information.
A variable in a variable?
In some use cases, you can need to have "a variable in a variable", which means that you will have a variable whose the source is also a variable.
It mostly concerns the product variable.
For example, on the basket page, we would like to exclude the all category related to the last purchase the client made (if he bought an Iphone, we would like to exclude all the mobile category).
In my catalog, the mobile is the level 3 of my categories.
Step 1
Go on the XO console, then in the 'Developers' menu, click on 'Variables'.
Click on 'Add a new variable' to create your first variable:
Step 2
Your source, instead of being the $productId, will be a variable which will collect the client last buy, a user variable. In this example, the source $user_lastbuy has already been created according to the steps above.
We'll now create a product variable, also according the all the steps we've already seen:
Step 3
We can complete the other fields according to the steps we've seen on the product variable chapter.
To remind, we want to have all the mobile category, which is the level 3:
Save your variable.
You can make some advanced settings, like putting a transformation or add a prefix.
It's not mandatory but it can be a good way to homogenize all the variables. To see the best way to use these advanced settings, you can read this article.
This way, we have:
- A user variable which collect the last purchase (the Iphone Id in this example)
- A product variable which will have this last purchase as source and retrieve the associated level 3 (the mobile category)
Application with a scenario
On the basket page, we would like to exclude the all category related to the last purchase the client made.
We just have to go to merchandising rules and put the product variable on the excluded tags field (as this variable will collect a category and not Ids, we're putting it on the tags fields, not the items ones).
This variable will adapt each last purchase of each customer and exclude the level 3 associated.
If we bought an Iphone, it will exclude the mobile category, but if we bought a Nintendo Switch, it will exclude all the game console category.
Conclusion
Congratulations! You now know how to create a variable in XO.
Let us know in the comment section if there are other test scenarios you would like us to create how-to guides for.
Enjoy your XO experience 😊
Should you encounter any difficulty setting up a custom scoring of your own please don’t hesitate to contact us by clicking here or clicking the submit a case link on the Support Centre and choosing “I have a question” from the list of use cases.
Kommentare
0 Kommentare
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.