Developers

Pushpopular

Overview

This component shows push contents. If there are not enough contents to fill the section, it retrieves popular contents to complete it.

Usage

How to create this component.

sdk.component('pushpopular', target:String, options:Object);

Sample

By default, this component looks like this:

Target

This is the HTML component. For example, the "#inbenta" target is:

<div id="inbenta"></div>

Options

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 that may be returned in collection. Minimum:1. Max:100
interval string allTime Time interval to retrieve popular contents. Possible values: allTime, lastWeek and lastDay.

Default options object

{
  categoryID: 0,
  length: 5,
  interval: 'allTime',
  contents: { <more info in subcomponent> }
}

Methods

Methods can be used in this component.

Name Description
setContentsDataInterceptor(interceptor:function) Set a contents interceptor.
setRelatedDataInterceptor(interceptor:function) Set a related interceptor.

Subcomponents

This component has some components inside which can be configured. This components are:

Name Description
contents Component to render each content

Events

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

Tracking

This component calls the API endpoint /tracking/events to register a click event when a user clicks on a content.

Labels

Labels of this component. The default labels of each component can be rewritten in the SDK creation configuration.

Name Default Description
PUSHPOPULAR_TITLE Maybe you are interested in: HTML for pushpopular title
PUSHPOPULAR_TEXT* Interesting contents HTML for pushpopular text. Hidden by CSS.

Examples

Create push&popular component with related contents.

sdk.component('pushpopular', '#popular', {
    contents: {
        showRelated: true
    }
});