Developers

SetContext

Usage

Use this method to log the user information for rating events from a search source without linking it to a specific session.

Note: User information logged using the setContext method will be overwritten if the setSearchContext method is called afterwards.

Mandatory parameters

This method accepts only one parameter, which is mandatory.

Name Type Description
context function This function's logic needs to generate the desired user information (context) and return it. The character limit is 512. To exceed this character limit, use the setSearchContext method instead.

Optional parameters

This method has no optional parameters.

Response data format

This method does not return any values.

Example

const userInfo = {
    username: "John Doe",
    company: "Inbenta"
};

sdk.client.setContext(() => userInfo);