Frontend

Recommendation Widgets

3min
magento enterprise edition (adobe commerce) has a feature called dynamic blocks these blocks are not present in magento’s full page cache, they are rendered after a page load and can be used to show blocks only to certain customer groups this caused issues with recommendations as the javascript had already fired before these blocks loaded, causing them not to render when adding 2 recommendation banners to the same page often the second will not render as the first banner causes klevu's javascript to fire before it is aware of the second to avoid these issues, rather than merchants entering the following to create the recommendations banner this has to be changed to the first div loads content faster, but may not work in every scenario the second div will always work, but loads the recommendations banner after the page is rendered the manual approach to adding these banners can still be taken, however we have created a widget to add recommendations to the site that will handle this to add a recommendations widget (there are other ways, this is just one example) login to the admin navigate to content > elements > widget click add widget from the type dropdown select klevu recommendations from the design theme dropdown select your theme click continue enter a widget title enter sort order (optional) set layout update i e where the widget will appear click the widget options tab enter your klevu recommendations id e g k a123b45c copy this code 6789d01e23f4 enter a block title (optional) you can add titles in kmc, however this enables a merchant to use the same banner with different titles on different pages/stores select if this widget requires power up ( yes will add the extended code above that will work everywhere no will add the single line of html, loads faster, but may not work in every situation) click save a cache flush may be required to see the output on the frontend if you experience any issues with recommendation banners not loading as expected try switching requires power up to yes