Recommendations callback
Describes the callbacks used for product recommendations.
Optimizely returns product recommendations in the form of a JavaScript callback method. When the product recommendations are ready, they are passed to this callback function in the form of JSON data.
var PeeriusCallbacks={
smartRecs:function(jsonData) {
// implementation ….
}
}The jsonData parameter is a list of recommendation widget elements that have the following properties.
ImportantYou must use
postion(notwidget) to render recommendations because thepositionvalue is consistent and ensures your AB tests will continue working.If your rendering code refers to
widgetinstead ofposition, your code will fail to render the recommendations if someone changes the name of the widget.
| Name | Description and usage | |||
|---|---|---|---|---|
| widget | [String] Name of widget. Use for information only because this varies during A/B testing. To determine where to place a widget on the page, use the position attribute, below. |
|||
| alias | [String] Alias of the widget. This is used internally by Optimizely Personalization. It should be used for information only. |
|||
| position | [String] Name of the page position for this widget. This attribute should be used to determine the page position in which to show the widget. It needs to be a unique ID. This value is stable and should be used to reference (rather than widget). |
|||
| recs | A list of recommendations | |||
| img | [String] URL of the product image. |
|||
| title | [String] Product title. |
|||
| url | [String] URL to the item's product page. |
|||
| refCode | [String] Product reference code. |
|||
| prices | A map in which
|
|||
| unitPrice | [Number] The item's price per unit. |
|||
| salePrice | [Number] The item's sale price. |
|||
|
id |
[64bit Number] Recommendation id. This is used for marking clicks. See Marking clicks. |
|||
| attributes | A list of attributes and their values. Attributes requested in the tracking request. See Additional attributes in recommendations. |
|||
Updated 3 months ago