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

# Overview

> The tolt.js script is a JavaScript library that automatically tracks partner clicks and can convert them into leads on your website/app

## Installation

Add the tolt.js script to the head of your website/app:

<Tabs>
  <Tab title="Default">
    ```html theme={"system"}
    <script
      src="https://cdn.tolt.io/tolt.js"
      data-tolt="YOUR_PUBLIC_ORG_KEY"
    ></script>
    ```
  </Tab>

  <Tab title="Alternative">
    ```javascript theme={"system"}
    <script>
      var toltScript = document.createElement('script'); 
      toltScript.src = 'https://cdn.tolt.io/tolt.js'; 
      toltScript.setAttribute('data-tolt', 'YOUR_PUBLIC_ORG_KEY'); 
      document.head.appendChild(toltScript);
    </script>
    ```
  </Tab>
</Tabs>

## Tracking Data

When a visitor arrives through a partner link, `window.tolt_data` contains:

```javascript theme={"system"}
{
  click_id: "30aa8b8d-b846-4827-bd6f-6beb16466841",
  cookie_duration: 30,
  partner_id: "f468da94-f786-485c-9314-3008ce472188",
  program_id: "prg_YRsbPDAKhWAdqJbFACheh",
  customer_id: null  // Only present after signup
}
```

If no affiliate link was used, `window.tolt_data` will be `null`.

### Lead Tracking

The script provides a signup function to convert clicks into leads:

```javascript theme={"system"}
const result = await window.tolt.signup("unique_identifier");
// unique_identifier can be an email or unique ID

// Returns:
{
  click_id: "30aa8b8d-b846-4827-bd6f-6beb16466841",
  customer_id: "cus_aE1xbsSk3HuZk58B2usFXNSv",
  customer_identifier: "unique_identifier",
  partner_id: "f468da94-f786-485c-9314-3008ce472188",
  program_id: "prg_YRsbPDAKhWAdqJbFACheh",
  message: "Success"
}
```

After a successful signup, `window.tolt_data` will be updated to include the `customer_id`.
