This component shows popular contents.
How to create this component.
sdk.component('popular', target:String, options:Object);
By default, this component looks like this:
This is the HTML component. For example, the "#inbenta" target is:
<div id="inbenta"></div>
Available options to set in this component
Name | Type | Default | Description |
---|---|---|---|
categoryId | integer | 0 | Knowledge instance category ID |
length | integer | 5 | Maximum number of items to be displayed as popular contents. Minimum:1. Max:100 |
interval | string | allTime | Time interval from which the most popular contents should be retrieved. Possible values: allTime, lastWeek and lastDay. |
Default options object
{
categoryId: 0,
length: 5,
interval: 'allTime',
contents: { <more info in subcomponent> }
}
Methods can be used in this component.
Name | Description |
---|---|
setContentsDataInterceptor(interceptor:function) |
Set a contents interceptor. |
setRelatedDataInterceptor(interceptor:function) |
Set a related interceptor. |
getPopularResults |
This method allows you to change the Option values with which the Popular component was initially set up when it was created. |
This component contains a subcomponent that can be configured. This component is:
Name | Description |
---|---|
contents | Component to render each content |
Events to listen on this component:
Name | Params | Description |
---|---|---|
click | content : Content object |
Sent whether a content is clicked |
expand | content : Content object |
Sent whether a content is expanded |
relatedClick | integer : Related content id |
Sent whether a related content is clicked |
decisionTreeClick | decisionTree : Decision tree object |
Sent whether a decision tree content is clicked |
rateContent | rating : Rating object |
Sent whether a content rating is clicked |
This component calls the API endpoint /tracking/events
to register a click event when a user clicks on a content.
Labels of this component. The default labels of each component can be rewritten in the SDK creation configuration.
Name | Default | Description |
---|---|---|
POPULAR_TITLE | Popular |
HTML for popular title |
POPULAR_TEXT* | Frequently answered questions |
HTML for popular text. Hidden by CSS. |
Create popular component with related contents.
sdk.component('popular', '#popular', {
contents: {
showRelated: true
}
});