Customise API Request

Sometimes you need a bit more control over what a Klevu Recommendation banner is doing, whether that is dynamically excluding some products or adding some extra context like currency.

You can override any aspect of the API request being made to Klevu, even for a specific Recommendation Banner. For this purpose, we have provided one handy function, klevu_processRECSRecordQueries.

Simply implement this function within your own website code. We recommend adding this immediately after the klevu.interactive code which you use to specify your API Key, etc.

<html>
<head>
    <script src="https://js.klevu.com/core/v2/klevu.js"></script>
    <script src="https://js.klevu.com/recs/v2/klevu-recs.js"></script>
    <script type="text/javascript">
        klevu.interactive(function () {
            var options = {
                powerUp: {
                    recsModule: true
                },
                recs: {
                    apiKey: 'klevu-12345'
                }
            };
            klevu(options);
        });

        function klevu_processRECSRecordQueries(recordQueries, recsKey)
        {
            // Implement your API Request customisation here!
        }
    </script>
</head>

See the below for some usage examples: