---
title: Set Custom Helpers
slug: template-js/custom-helpers
docTags: 
createdAt: 2023-06-16T14:21:44.000Z
---



Occasionally, there are requirements to add your own helper functions to the Klevu Templates. These helper functions can be used to reference local configurations, or modify existing Klevu Template functions to meet specific requirements.

## Set the Helper Function

Assign custom helpers using `setHelpers` within the Klevu options object using the following format:

:::BlockQuote
...
&#x20;  setHelpers: \{
&#x9;      "\<scope identifier(s)>": \{&#x20;
&#x9;           myHelperName: \<function()>
&#x20;         }
&#x9;}
...
:::

e.g.

:::BlockQuote
klevu(\{
&#x9;theme: \{
&#x9;	setHelpers: \{
&#x20;           "all": \{
&#x20;               helloKlevu: function()\{
&#x20;                  return 'Hello Klevu!'
&#x20;               }
&#x20;           },
&#x20;           "recs,quick": \{
&#x20;                myHelper: function()\{}
&#x20;           }
&#x20;       }
&#x9;}
});
:::



## Call the Helper Function

Reference helpers within a Klevu Template

:::BlockQuote
\<script type="template/klevu" id="anyKlevuTemplate" >
&#x20;     \<span style="color: red;">\<%= helper.helloKlevu() %>\</span>
\</script>
:::

