Search X / Getting Started / Core Script Tag

Core Script Tag

Add our script tag anywhere near the closing </body> tag tag of your theme. This will initialize our widgets into the previously mentioned html containers: #sx-autocomplete and #sx-results and allow for any configuration options to enter the DOM before our script is initialized.

*You are not required to paste the above script into the head of your page, you can paste it anywhere — even in the footer — but higher on the page will help a marginal amount with load time. It is not a huge difference, but every little bit helps.


  ;(function () {
    if (window.sx_loaded) return; window.sx_loaded = true;
    var sxt = document.createElement('script'); sxt.async = true;
    sxt.src = '{{ shop.permanent_domain }}/searchx-core';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(sxt, s);