Library Reference

Configuration

6min
specific configuration values used by klevu are kept as a snippet of code which looks something like the following var options = { url { search 'https //eucs3v2 ksearchnet com/cs/v2/search', landing '/search results', queryparam 'q' }, search { apikey 'klevu 123xxxxxxxxxxxxxx', searchboxselector 'input#klevu search', } analytics { apikey 'klevu 123xxxxxxxxxxxxxx' } }; klevu(options); settings settings available within options object object name field name description default value powerup quick quicksearch module true powerup landing landing page module true powerup catnav category page module true powerup recsmodule recommendations module true url search klevu apiv2 cloud search url endpoint required required url landing the url of the search results landing page (srlp) /search results url queryparam the query parameter appended to the srlp url q search apikey klevu js api key which will be used for search requests required required search infinitescrolloffset determines the pixel distance from bottom of the quicksearch (faceted layout display) to trigger the next result dataset 50 search infinitescrolloffsetlanding determines the pixel distance from bottom of the webpage to trigger the next result dataset determines the pixel distance of the page to trigger the next result dataset 50 search searchboxselector the id, class, or handle used to bind the search input field required required search searchboxtarget define a target for the results generation false search showquickonenter disable the enter/return key in the quick search false search sliderpricedelimiter set the delimiter between the currency symbol and the price for the price slider " " search fullpagelayoutenabled avoid focusout event false search minchars number of typed characters required 3 search placeholder placeholder text of the search box "" search personalisation control of personalisation false search redirects redirects for specific search term "term" "https //full url com" recs apikey klevu js api key used for smart recommendations analytics apikey klevu js api key used for general analytics reporting required required global apikey klevu js api key used for all components optional theme quicksearch loaddefaultstyles stop klevu quicksearch template styles from loading true theme landing loaddefaultstyles stop klevu srlp template styles from loading true theme catnav loaddefaultstyles stop klevu category template styles from loading true theme settemplates specify one or more klevu templates to override read set template docid 6yvx9naw6ax68wygucob7 for more information theme modules resultinfinitescroll quicksearch enable set "true" to enable infinite scroll theme modules resultinfinitescroll searchresultspage enable set "true" to enable infinite scroll theme modules resultinfinitescroll categorypage enable set "true" to enable infinite scroll fetchsettings fallback set "true" to activate the fetch fallback to use fetch interface with url + headers this is useful native fetch function has been replaced useful local storage settings key name key value default description klv limits productlist 12 by default the template js library makes 12, 24, and 36 options available, but this can be set to any number klv limits contentlist 12 by default the template js library makes 12, 24, and 36 options available, but this can be set to any number code eample // this code waits for klevu js to load first window klvready= window klvready|| \[]; window klvready push(function(){ // we will set the items per page one time using a variable var itemsperpage = 24; // now we can use the variable to set both the product and content tab // items per page localstorage setitem('klv limits productlist', itemsperpage); localstorage setitem('klv limits contentlist', itemsperpage); }); useful session storage settings for key names that include \[apikey] you would replace this with your account's apikey value here's an example sessionstorage setitem(`klv view klevu 14728819608184175 productlist`, 'grid'); key name key value default description klv view \[apikey] productlist grid available values are "grid" and "list" klv view \[apikey] contentlist list available values are "grid" and "list" code example // this code waits for klevu js to load first window klvready= window klvready|| \[]; window klvready push(function(){ // run this function when search and/or category pages load klevu beforeactivation('landing,catnav', function(data ,scope){ // set session storage value using a useful function to dynamically // retrieve your apikey sessionstorage setitem(`klv view ${klevu pagemeta getapikey()} productlist`, 'list'); }, 'build'); });