KPP Software Development Kit API Reference

The KPP SDKs provide developers with the building blocks to start building on top of the Monetate platform. These SDKs provide standardized functions that abstract low-level Engine API calls to help you save time and effort in development. Refer to Calling the Engine API for information on making Engine API requests.

Methods

The following methods are available.

FunctionDescriptionExample
KiboPersonalization()Initialization method that creates the object used for all SDK activities. Initialize this with the objects account, user, and contextMap.
Personalization = new KiboPersonalization({
 account: {
 domain: 'monetate.mybigcommerce.com',
 name: 'a-3e41bf76',
 instance: 'p',
 shortname: 'monetate-browser-testing'
 },
 user: {
 kiboId: ‘auto’,
 deviceId: '12345678',
 customerId ? : 'sample@email.com'
 },
 contextMap ? : {
 UserAgent: 'auto',
 Cart: ...,
 PageView: ...
 }
})
setCustomerID()Sets customerId in the user object to the specified value.
Personalization.setCustomerId('DJS12331SD12')
report()Adds events to the queue. These events are sent either automatically as part of the next timed send, or manually with the flush method.
Personalization.report(
 context,
 eventData
)
flush()Sends all queued data immediately.
Personalization.flush()
getActions()Records events and returns the decisions from those events. Specify events as a list event identifiers in strings.
Returns a JSON object containing a status code and if successful a list of actions, their actionType, and associated data.
Personalization.getActions(
 context,
 requestId,
 events
})

Objects

The following objects are used in this SDK.

ObjectDescriptionNotes
accountContains the following objects:
  • domain
  • name
  • instance
  • shortname
userContains the following objects:
  • kiboId
  • deviceId
  • customerId
This object must contain a value from either kiboId or deviceId.
contextMapContains contextual data and variables.Some objects contained within can be set to auto to automatically populate data.

Events

The following strings can be used as events for the report or getActions methods.

StringEvent RecordExample
Impressionsmonetate:record:Impressions
{
 "impressionIds": [
 "2.MS4xLjE1MTQ4MDg5MDA"
 ]
}
PageEventsmonetate:record:PageEvents
{
 "pageEvents": ["myEvent"]
}
EndcapClicksmonetate:record:EndcapClicks
{
 "endcapClicks": [
 {
 "actionId": "1234567",
 "products": [
 {
 "productId": "product72",
 "sku": "product72-large-green",
 }
 ]
 }
 ]
}
EndcapImpressionsmonetate:record:EndcapImpressions
{
 "endcapImpressions": [
 {
 "actionId": "1234567",
 "products": [
 {
 "productId": "product72",
 "sku": "product72-large-green",
 },
 {
 "productId": "product43",
 "sku": "product43-medium-striped"
 },
 {
 "productId": "product57"
 }
 ]
 }
 ]
}
PageViewmonetate:context:PageView
{
 "url": "http://www.monetate.com/index.html",
 "pageType": "home",
 "categories": ["category"],
 "breadcrumbs": ["breadcrumb"]
}
Cartmonetate:context:Cart
{
 "cartLines": [{
 "sku": "SKU1",
 "pid": "PID1",
 "quantity": 2,
 "currency": "USD",
 "value": "24.00"
 }]
}
Purchasemonetate:context:Purchase
{
 "purchaseId": "1b2c3d",
 "purchaseLines": [{
 "sku": "SKU1",
 "pid": "PID1"
 "quantity": 2,
 "currency": "USD",
 "value": "24.00"
 }]
}
ProductDetailViewmonetate:context:ProductDetailView
{
 "products": [
 {
 "productId": "product72",
 "sku": "product72-large-green",
 },
 {
 "productId": "product43",
 "sku": "product43-medium-striped"
 },
 {
 "productId": "product57"
 }
 ]
}
ProductThumbnailViewmonetate:context:ProductThumbnailView
{
 "products": ["product72", "product43", "product42"]
}
Metadatamonetate:context:Metadata
{
 "metadata": {
 "language": "en-GB"
 }
}
CustomVariablesmonetate:context:CustomVariables
{
 "customVariables": [{
 "variable": "favoriteTeam",
 "value": "Blue Hens"
 }]
}

Actions

The following strings are possible return values from the getActions method.

StringAction
DataCollectionmonetate:action:DataCollection
OmniChannelHtmlmonetate:action:OmniChannelHtml
OmniChannelJsonmonetate:action:OmniChannelJson
OmnichannelRecommendationmonetate:action:OmnichannelRecommendation

contextMap Objects

The following objects in the contextMap object can be set to auto.

StringContext
UserAgentmonetate:context:UserAgent
IpAddressmonetate:context:IpAddress
Referrermonetate:context:Referrer
Coordinatesmonetate:context:Coordinates
ScreenSizemonetate:context:ScreenSize