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.
Function | Description | Example |
---|---|---|
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.
Object | Description | Notes |
---|---|---|
account | Contains the following objects:
| |
user | Contains the following objects:
| This object must contain a value from either kiboId or deviceId . |
contextMap | Contains 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.
String | Event Record | Example |
---|---|---|
Impressions | monetate:record:Impressions | { "impressionIds": [ "2.MS4xLjE1MTQ4MDg5MDA" ] } |
PageEvents | monetate:record:PageEvents | { "pageEvents": ["myEvent"] } |
EndcapClicks | monetate:record:EndcapClicks | { "endcapClicks": [ { "actionId": "1234567", "products": [ { "productId": "product72", "sku": "product72-large-green", } ] } ] } |
EndcapImpressions | monetate:record:EndcapImpressions | { "endcapImpressions": [ { "actionId": "1234567", "products": [ { "productId": "product72", "sku": "product72-large-green", }, { "productId": "product43", "sku": "product43-medium-striped" }, { "productId": "product57" } ] } ] } |
PageView | monetate:context:PageView | { "url": "http://www.monetate.com/index.html", "pageType": "home", "categories": ["category"], "breadcrumbs": ["breadcrumb"] } |
Cart | monetate:context:Cart | { "cartLines": [{ "sku": "SKU1", "pid": "PID1", "quantity": 2, "currency": "USD", "value": "24.00" }] } |
Purchase | monetate:context:Purchase | { "purchaseId": "1b2c3d", "purchaseLines": [{ "sku": "SKU1", "pid": "PID1" "quantity": 2, "currency": "USD", "value": "24.00" }] } |
ProductDetailView | monetate:context:ProductDetailView | { "products": [ { "productId": "product72", "sku": "product72-large-green", }, { "productId": "product43", "sku": "product43-medium-striped" }, { "productId": "product57" } ] } |
ProductThumbnailView | monetate:context:ProductThumbnailView | { "products": ["product72", "product43", "product42"] } |
Metadata | monetate:context:Metadata | { "metadata": { "language": "en-GB" } } |
CustomVariables | monetate:context:CustomVariables | { "customVariables": [{ "variable": "favoriteTeam", "value": "Blue Hens" }] } |
Actions
The following strings are possible return values from the getActions
method.
String | Action |
---|---|
DataCollection | monetate:action:DataCollection |
OmniChannelHtml | monetate:action:OmniChannelHtml |
OmniChannelJson | monetate:action:OmniChannelJson |
OmnichannelRecommendation | monetate:action:OmnichannelRecommendation |
contextMap Objects
The following objects in the contextMap
object can be set to auto.
String | Context |
---|---|
UserAgent | monetate:context:UserAgent |
IpAddress | monetate:context:IpAddress |
Referrer | monetate:context:Referrer |
Coordinates | monetate:context:Coordinates |
ScreenSize | monetate:context:ScreenSize |