Installation

The LoyaltyLion SDK needs to be added into your store’s template or theme to identify customers and render UI components.

We automatically install the LoyaltyLion SDK into your theme on Shopify, BigCommerce and Adobe Commerce.

Add the SDK snippet to your template

Copy the following snippet into your template’s </head>.

<script>
  !function(t,n){var e=n.loyaltylion||[];if(!e.isLoyaltyLion){n.loyaltylion=e,void 0===n.lion&&(n.lion=e),e.version=2,e.isLoyaltyLion=!0;var o=n.URLSearchParams,i=n.sessionStorage,r="ll_loader_revision",a=(new Date).toISOString().replace(/-/g,""),s="function"==typeof o?function(){try{var t=new o(n.location.search).get(r);return t&&i.setItem(r,t),i.getItem(r)}catch(t){return""}}():null;c("https://sdk.loyaltylion.net/static/2/"+a.slice(0,8)+"/loader"+(s?"-"+s:"")+".js");var l=!1;e.init=function(t){if(l)throw new Error("Cannot call lion.init more than once");l=!0;var n=e._token=t.token;if(!n)throw new Error("Token must be supplied to lion.init");var o=[];function i(t,n){t[n]=function(){o.push([n,Array.prototype.slice.call(arguments,0)])}}"_push configure bootstrap shutdown on removeListener authenticateCustomer".split(" ").forEach(function(t){i(e,t)}),c("https://sdk.loyaltylion.net/sdk/start/"+a.slice(0,11)+"/"+n+".js"),e._initData=t,e._buffer=o}}function c(n){var e=t.getElementsByTagName("script")[0],o=t.createElement("script");o.src=n,o.crossOrigin="",e.parentNode.insertBefore(o,e)}}(document,window);
</script>

Initialize the SDK

Once you’ve added the snippet, the LoyaltyLion SDK begins loading and assigns itself to window.loyaltylion, but is inactive until you initialize it with the loyaltylion.init method.

Refer to the initialization section for more information.

Add our UI components

When the SDK is initialized, you can start adding our UI components to your pages. The quickest way to get started is use our combined Loyalty Panel component, which can be embedded on a page or opened in a modal on demand.