Sometimes, you might need to run a script in DanDomain either before or after Clerk.io has rendered products. 

The most common use-case, is if you want to add Clerk.io's live-search to a Search-Field that is inserted after the initial page-load, or manually add recommendations to an Ajax popup.

For this, you can use the function  clerkBeforeRenderVariables() run your script before Clerk.io renders and clerkAfterRenderVariables() to run it after it loads.

For example:

<script type="text/javascript">
function clerkBeforeRenderVariables() {
   $("body").append(
      '<span class="clerk" data-template="@live-search" data-live-search-categories="true" data-live-search-categories-title="Kategorier" data-live-search-products-title="Produkter" data-bind-live-search=".SearchField_SearchPage:eq(1)"></span>');
}
</script>
Did this answer your question?