Skip to content

Customer Bias using the SDK

To get Customer Bias call the getCustomerBias SDK method

Arguments

Argument Type Description
data Bias request object See specification of the bias request object below.
callback(result) function Will be called when the bias data bas been fetched. The result will be a bias response. See more below below.

Bias request object

Property Type Description
fields String[] A list of field names that you want to fetch customer bias for.
numberOfValues Number The number of values you want to fetch for each field. Maxumum value is 10. Optional, default is 5.

Example Request

hrq = window.hrq || [];
hrq.push([
    "getCustomerBias",
    {
        fields: ["hierarchyLevel1", "brand"],
        numberOfValues: 2
    },
    function(response){
        console.log(response);
    }
]);

Bias response object

The response will contain a single object with a success property that indicates if the request succeeded. On success there will be a bias property containing the result. The bias is an object containing a property for each requested field. Each field is a list of the requested values, each value has a weight associated with it indicating how much the customer prefers that value compared to the other values.

Example response

{
    "bias": {
        "hierarchyLevel1": [
            {
                "value": "Men$",
                "weight": 60
            },
            {
                "value": "Woman$",
                "weight": 30
            },
            {
                "value": "Kids$",
                "weight": 10
            }
        ],
        "brand": [
            {
                "value": "Coretek",
                "weight": 70
            },
            {
                "value": "Nike",
                "weight": 30
            }
        ]
    }
}