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

# Installing Candu

## Installation

There are three core steps to installing Candu [(full guide here)](https://docs.candu.ai/en/articles/5908307-installing-candu):

**Step 1 – Get your Client Token**

1. Visit [https://app.candu.ai/settings](https://app.candu.ai/settings)
2. Scroll to **Access Keys**
3. Make a note of your **Client Token**

**Step 2 – Add the Script Tag**

Add the following to your application — choose the approach that fits your setup

Replace `YOUR_CLIENT_TOKEN` with the token from Step 1 and `CONTEXTUAL_USER_ID` with a unique ID for the logged-in user (e.g. the user ID from your database or auth system):

```html HTML theme={null}
<script>
  (function(d, params){
    var script = d.createElement('script');
    script.setAttribute('src', 'https://cdn.candu.ai/sdk/latest/candu.umd.js?token=' + params.clientToken);
    script.onload = function () {
        Candu.init(params);
    }
    d.head.appendChild(script);
  })(document, {
    userId: 'YOUR_USER_ID',
    clientToken: 'YOUR_CLIENT_TOKEN',
   });
</script>
```

```html HTML (React) theme={null}
<!-- in application header -->
<script src="https://cdn.candu.ai/sdk/latest/candu.umd.js?token=YOUR_CLIENT_TOKEN"></script>

<script >
// within your application at an appropriate time, once userId and email have been fetched:
useEffect(() => {
  if (userId) {
    Candu.init({
      userId: CONTEXTUAL_USER_ID,
      clientToken: YOUR_CLIENT_TOKEN,
      traits: {
        email: userEmail,
      },
    });
  }
}, [userId]);
</script>
```

**Step 3 – Whitelist Domains**

Whitelist the domains you are going to be using Candu on.

1. Depending on your Content Security Policy (CSP) you may also need to whitelist the following URLs:
   1. `https://api.candu.ai/`
   2. `https://cdn.candu.ai/`
   3. `https://media.candulabs.com/`
   4. *Optional* `https://sentry.io/` (Not required for functionality; used to capture errors)

**Please note:** You have the option to set up multiple [Workspaces](https://docs.candu.ai/en/articles/5894648-candu-workspaces) in Candu to separate and organize content, e.g., a workspace for your Staging/Sandbox environment and one for Production. Each workspace has a separate Candu script tag, whitelisting, and segmentation setup.

## Optional Steps

### Send user data and events to improve personalization

To use Candu's personalization features, you'll need to send user traits and events into Candu.

[How to send user traits and events into Candu](/docs/segmentation-overview)

### Enable Signed Identities

If you are sending personally identifiable information (PII), we recommend setting up [signed identities](https://docs.candu.ai/en/articles/5917940-enabling-identity-verification) for increased security and guaranteed event attribution.

<br />
