Build UI
Modify Recommendations

Examples

3min
modify recommendations below are some common uses of modifying the klevu smart recommendations data objects 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 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 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!'; } } }