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

# Initializing Smile UI

> `SmileUI.initialize(options)`

This method initializes Smile UI with information about the loyalty program to display and the currently logged in customer. This method must be called before you can interact with any other methods.

<Info>
  If you're loading the `Smile UI` script asynchronously, you should wrap your initialization code within a [loaded event](/ui/events/ui-loaded) to ensure it doesn't encounter an error due to the script not yet being present on the page.
</Info>

## Parameters

<ParamField path="options" type="object" required>
  <Expandable title="properties">
    <ParamField path="publishableKey" type="string" required>
      Your Smile.io publishable key. This is used for identifying your store and can be made public. Refer to the [help docs](https://help.smile.io/en/articles/11878403-find-a-publishable-key) for where to find it.
    </ParamField>

    <ParamField path="customerToken" type="string">
      A [customer token](/ui/customer-tokens) identifying the currently logged-in customer. This should be `null` or omitted entirely if no customer is currently logged-in.
    </ParamField>

    <ParamField path="includeSdk" type="boolean" default="false">
      Whether to load the and initialize Smile's [JavaScript SDK](/js/introduction) (Smile.js) alongside Smile UI. This is useful when you want to also have the methods and objects available from the JavaScript SDK available on the page as well.
    </ParamField>
  </Expandable>
</ParamField>

<Panel>
  ```javascript JavaScript lines theme={null}
  // If the script is loaded synchronously
  SmileUI.initialize({
    publishableKey: "pub_0987654321",
    customerToken:
      "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhcGkuc21pbGUuaW8iLCJzdWIiOiJTaG9waWZ5Q3VzdG9tZXI6MTA3MzM0NTgiLCJleHAiOjE1ODU1OTE1MzZ9.3SOqHMbmqvfuzHLrABbFNzwlgkFJnj8xtubttfmM4-o",
  });

  // If the script is loaded asynchronously
  document.addEventListener("smile-ui-loaded", () => {
    SmileUI.initialize({
      publishableKey: "pub_0987654321",
      customerToken:
        "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhcGkuc21pbGUuaW8iLCJzdWIiOiJTaG9waWZ5Q3VzdG9tZXI6MTA3MzM0NTgiLCJleHAiOjE1ODU1OTE1MzZ9.3SOqHMbmqvfuzHLrABbFNzwlgkFJnj8xtubttfmM4-o",
    });
  });
  ```
</Panel>
