Build UI
Modify Recommendations
Overview
7min
modify recommendations this guide is for working with the klevu api request and response data for klevu smart recommendations direct editing of the display markup is achieved within the klevu merchant center please review the knowledge base article for more details on how to work with the recs template editor it is possible to modify the klevu recommendations query, response, or template data for any or all of your recommendation banners you can do this by adding one or more of the following hook functions, after the klevu initialization within each of these hook functions, you will find relevant objects and variables that you can use to modify the default behavior provided by klevu note the recskey value is the id provided with each recommendation banner this value can be used to specifically target a specific banner for modification modify recs request any of the klevu api parameters are available to be applied as needed or otherwise to override any default values within the recordqueries object function klevu processrecsrecordqueries(recordqueries, recskey) { console log(recordqueries, recskey); } modify recs response any of the product attributes are available to be modified as needed or otherwise inject any custom values via queryresults function klevu processrecsqueryresults(queryresults, recskey) { console log(queryresults, recskey); } modify recs template data any of the template attributes are available to be modified as needed or otherwise inject any custom values via templatedata function klevu processrecstemplatedata(templatedata, recskey) { console log(templatedata, recskey); } after recs render after the recommendations template renders, a ny custom javascript action can be executed function klevu bindrecstemplateelementevents(templatedata, recskey) { console log(templatedata, recskey); } recs item click event onclick of an item within the recommendations banner any custom javascript action can be executed function klevu recsitemclick(templatedata, itemid, recskey) { console log(templatedata, itemid, recskey); } examples please see the modify recommendations examples docid\ dx6yjacsbv cxuxcrczji section for details of common uses