> ## Documentation Index
> Fetch the complete documentation index at: https://developers.loyaltylion.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Initialize the SDK

You can interact with the LoyaltyLion SDK using its JavaScript API. You can use this to initialize and authenticate the SDK, configure various settings, and listen to events emitted when customers take various actions.

The LoyaltyLion SDK adds itself to the `window.loyaltylion` variable.

## Initialization

<Info>
  `loyaltylion.init` is called automatically for Shopify, BigCommerce and Adobe
  Commerce installations.
</Info>

`loyaltylion.init` should be called once per page load to initialize the LoyaltyLion SDK and (if applicable) authenticate the current logged in customer. You'll need your <a href="https://app.loyaltylion.com/go/manage/settings/" target="_blank">LoyaltyLion site token</a> to identify your store.

### Initialize example without customer

```js theme={null}
loyaltylion.init({
  token: 'YOUR_SITE_TOKEN',
})
```

<Warning>
  `loyaltylion.init` should only ever been called once per page load. Calling
  this method more than once throws an exception error and result in a slower
  user experience.
</Warning>

If a customer is logged in, their information and authentication data should be passed in, using a [server-side generated auth token](/sdk/customer-authentication#create-the-auth-token).

### Initialize example with customer

```js theme={null}
loyaltylion.init({
  token: 'YOUR_SITE_TOKEN', // site token
  customer: {
    id: '1001', // unique customer ID
    email: 'alice@example.com', // customer email address
  },
  auth: {
    date: '2018-01-01T10:00:00Z', // date in ISO 8601 format
    token: 'AUTH_TOKEN', // token, generated server-side, different than the site token
  },
})
```
