---
title: Examples
slug: template-js/modify-recommendations-example
docTags: 
createdAt: 2023-06-16T15:28:16.000Z
---

# Modify Recommendations&#x20;

Below are some common uses of modifying the Klevu Smart Recommendations data objects.&#x20;

Please review : The Modify Recommendations [Overview](docId\:O03QERB3F-sY0BHba64Af) for complete details and options.



## Modify Recommendations API Request

The below snippet contains a few examples of API query modifications using the Recommendations webhook

:::CodeblockTabs
JavaScript

```javascript
<script type = "text/javascript" >
function klevu_processRECSRecordQueries(recordQueries, recsKey)
{
    var recsQuery = recordQueries[0];

    // eg. change the result limit to 10
    klevu.setObjectPath(recsQuery, "settings.limit", 10);

    // eg. add a category context of "Clothing"
    klevu.setObjectPath(recsQuery, "settings.query.categoryPath", "Your Category");

    // eg. exclude some results for a specific banner only
    if (recsKey == 'abc-123-xyz-321') {
        var excludeIds = [
            {
              key: "id", // or itemGroupId
              value: "the-id-to-exclude"
            }
        ];
        klevu.setObjectPath(recsQuery, "settings.excludeIds", excludeIds);
    }

    // Klevu Recommendations utilise Klevu API,
    // you can therefore modify any of the params in our Docs.
    // See https://developers.klevu.com/api for all available parameters!
}
</script>
```
:::



## Modify Recommendations Template Object

The below example changes the configured `title` for a specific Recommendation banner

```javascript
function klevu_processRECSTemplateData(templateData, recsKey) {
        
    /* apply only to the specified recsKey <id> */
    if (recsKey ==  'abc-123-xyz-321') {
                
        /* replace the title as desired */
        templateData.metadata.title = 'Just For You!';
  
    }
}
```

}
