Installation

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

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

Add the SDK snippet to your template

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

<script>
  !function(t,n){function o(n){var o=t.getElementsByTagName("script")[0],i=t.createElement("script");i.src=n,i.crossOrigin="",o.parentNode.insertBefore(i,o)}if(!n.isLoyaltyLion){window.loyaltylion=n,void 0===window.lion&&(window.lion=n),n.version=2,n.isLoyaltyLion=!0;var i=new Date,e=i.getFullYear().toString()+i.getMonth().toString()+i.getDate().toString();o("https://sdk.loyaltylion.net/static/2/loader.js?t="+e);var r=!1;n.init=function(t){if(r)throw new Error("Cannot call lion.init more than once");r=!0;var a=n._token=t.token;if(!a)throw new Error("Token must be supplied to lion.init");for(var l=[],s="_push configure bootstrap shutdown on removeListener authenticateCustomer".split(" "),c=0;c<s.length;c+=1)!function(t,n){t[n]=function(){l.push([n,Array.prototype.slice.call(arguments,0)])}}(n,s[c]);o("https://sdk.loyaltylion.net/sdk/start/"+a+".js?t="+e+i.getHours().toString()),n._initData=t,n._buffer=l}}}(document,window.loyaltylion||[]);
</script>

Initialize the SDK

Once you’ve added the snippet, the LoyaltyLion SDK will begin loading and assign itself to window.lion, but will be inactive until your initialize it with the lion.init method.

Refer to the initialization section of our JavaScript API docs 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.