---
title: Recommendations callback
slug: product-recommendations/docs/recommendations-callback
docTags: 
createdAt: 2026-07-30T20:41:30.719Z
---

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.

```json
var PeeriusCallbacks={
      smartRecs:function(jsonData) {
        // implementation ….
      }
    }
```

The `jsonData` parameter is a list of recommendation widget elements that have the following properties.

:::hint{type="warning"}
**Important**
You must use `postion` (not `widget`) to render recommendations because the `position` value is consistent and ensures your AB tests will continue working.

If your rendering code refers to `widget` instead of `position`, your code will fail to render the recommendations if someone changes the name of the widget.
:::

| Name     |      |            |           | Description and usage                                                                                                                                                                                                                                                |
| -------- | ---- | ---------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| widget   |      |            |           | \[String]<br />Name of widget.<br />Use for information only because this varies during A/B testing.<br />To determine where to place a widget on the page, use the position attribute, below.                                                                       |
| alias    |      |            |           | \[String]<br />Alias of the widget.<br />This is used internally by Optimizely Personalization. It should be used for information only.                                                                                                                              |
| position |      |            |           | \[String]<br />Name of the page position for this widget.<br />This attribute should be used to determine the page position in which to show the widget. It needs to be a unique ID.<br />This value is stable and should be used to reference (rather than widget). |
|          | recs |            |           | A list of recommendations                                                                                                                                                                                                                                            |
|          |      | img        |           | \[String]<br />URL of the product image.                                                                                                                                                                                                                             |
|          |      | title      |           | \[String]<br />Product title.                                                                                                                                                                                                                                        |
|          |      | url        |           | \[String]<br />URL to the item's product page.                                                                                                                                                                                                                       |
|          |      | refCode    |           | \[String]<br />Product reference code.                                                                                                                                                                                                                               |
|          |      | prices     |           | A map in which<br />- the key is the currency name (such as USD, GBP, and so on)<br />- the value is a map with unitPrice and salePrice properties.                                                                                                                  |
|          |      |            | unitPrice | \[Number]<br />The item's price per unit.                                                                                                                                                                                                                            |
|          |      |            | salePrice | \[Number]<br />The item's sale price.                                                                                                                                                                                                                                |
|          |      | id         |           | \[64bit Number]<br />Recommendation id.<br />This is used for marking clicks. See [Marking clicks](docId\:x-UWMNCr7HCibp_1X8Mrx).                                                                                                                                    |
|          |      | attributes |           | A list of attributes and their values.<br />Attributes requested in the tracking request. See [Additional attributes in recommendations](docId:9yjV4ZBn-3FvtUTN-4vDt).                                                                                               |
