Get user & shop bias
It is possible to get the user- & shop-bias using the following JavaScript SDK method: getBias
.
The user-bias contains the preferred brand & hierarchies (categories) for the specific user, whereas the shop bias is the most popular brands & hierarchies (categories) throughout the webshop. This function can be used to create personalized categories on the front page, which update based on the users' preferences.
Example
To request the bias push the getBias
command to the command queue, along with a callback.
hrq = window.hrq || [];
hrq.push([
"getBias",
function(response){
console.log(response); // The response contains the shop & user bias
}
]);
The response has two object types, shop
and user
. The shop
bias contains the favourite brands and hierarchies (categories) throughout the webshop. The user
contains the user-specific preferences.
If implementing a personalized category box for a user, then use the shop-based bias as a fallback, if the user
object is null (if we don't recognize the user).
{
"shop": {
"hierarchyLevel3": [
{
"value": "video$hdmi$hdmi$",
"weight": 18
},
{
"value": "computer$usb$usb$",
"weight": 12
},
{
"value": "portable apparaten$mobiele telefoon/tablet$laden$",
"weight": 11
},
{
"value": "portable apparaten$mobiele telefoon/tablet$audio/video$",
"weight": 10
},
{
"value": "computer$usb$usb-c$",
"weight": 10
},
{
"value": "portable apparaten$mobiele telefoon/tablet$data$",
"weight": 10
},
{
"value": "apple® compatibel$macbook pro® retina$usb$",
"weight": 8
},
{
"value": "apple® compatibel$macbook® retina$usb$",
"weight": 8
},
{
"value": "beugels$tv \\u0026 monitor$muurbeugel$",
"weight": 7
},
{
"value": "apple® compatibel$macbook pro®$usb$",
"weight": 7
}
],
"hierarchyLevel1": [
{
"value": "computer$",
"weight": 25
},
{
"value": "portable apparaten$",
"weight": 14
},
{
"value": "video$",
"weight": 14
},
{
"value": "stroom$",
"weight": 10
},
{
"value": "audio$",
"weight": 9
},
{
"value": "apple® compatibel$",
"weight": 8
},
{
"value": "beugels$",
"weight": 7
},
{
"value": "gaming$",
"weight": 6
},
{
"value": "hdmi$",
"weight": 4
},
{
"value": "usb-c$",
"weight": 3
}
],
"brand": [
{
"value": "Dolphix",
"weight": 22
},
{
"value": "Coretek",
"weight": 16
},
{
"value": "Nedis",
"weight": 11
},
{
"value": "Transmedia",
"weight": 9
},
{
"value": "My Wall",
"weight": 8
},
{
"value": "DeLOCK",
"weight": 8
},
{
"value": "OTB",
"weight": 7
},
{
"value": "Goobay",
"weight": 7
},
{
"value": "S-Impuls",
"weight": 6
},
{
"value": "VHBW",
"weight": 5
}
],
"hierarchyLevel2": [
{
"value": "portable apparaten$mobiele telefoon/tablet$",
"weight": 19
},
{
"value": "computer$usb$",
"weight": 19
},
{
"value": "video$hdmi$",
"weight": 12
},
{
"value": "beugels$tv \\u0026 monitor$",
"weight": 9
},
{
"value": "apple® compatibel$macbook pro® retina$",
"weight": 8
},
{
"value": "apple® compatibel$macbook pro®$",
"weight": 8
},
{
"value": "apple® compatibel$macbook air®$",
"weight": 7
},
{
"value": "apple® compatibel$macbook® retina$",
"weight": 7
},
{
"value": "stroom$laders en voedingen$",
"weight": 6
},
{
"value": "computer$netwerk$",
"weight": 6
}
]
},
"user": {
"hierarchy": [
{
"value": "audio$digitaal audio/spdif$coaxiaal audio rca$",
"weight": 33
},
{
"value": "audio$digitaal audio/spdif$toslink$",
"weight": 33
},
{
"value": "audio$tulp$",
"weight": 33
}
],
"brand": [
{
"value": "Coretek",
"weight": 100
},
{
"value": "Nike",
"weight": 70
}
]
}
}