> For the complete documentation index, see [llms.txt](https://documentation.freshpaint.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://documentation.freshpaint.io/reference/developer/freshpaint-sdk-options.md).

# Freshpaint Web SDK Options

### Init Options

Freshpaint's SDK accepts a number of options in its `init` method. We'll go over those options in this document. Here's a typical invocation of `init`, which you can find in our Autotrack snippet:

```javascript
freshpaint.init("11111111-2222-3333-4444-555555555555", {
  "api_host": "https://my.api.host/prod",
  "app_host": "https://my.app.host"
});
```

Below is a table of the options we support with the `init` method:

| Option                        | Type    | Default                   | Description                                                                                                                                                                                                                                                                                                                                            |
| ----------------------------- | ------- | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `api_host`                    | string  | (your account's api host) | We use `api_host` to communicate with our servers, whether that's loading event definitions or tracking events. You shouldn't change the value of this option without specific guidance from Freshpaint.                                                                                                                                               |
| `app_host`                    | string  | (your account's app host) | This is an internal option we use to support client-side events and our [Visual Tagger](/admin-panel/events/visual-tagger.md). You shouldn't change this value without specific guidance from Freshpaint.                                                                                                                                              |
| `autotrack`                   | boolean | `true`                    | This option enables or disables auto-tracking features. Use this if you would like to manually trigger track events.                                                                                                                                                                                                                                   |
| `consent_management`          | boolean | `{}`                      | This enables consent manager, see additional documentation [here](/integrations/consent-management.md).                                                                                                                                                                                                                                                |
| `cookie_expiration`           | integer | `365`                     | This is how many days will elapse before the Freshpaint cookie expires.                                                                                                                                                                                                                                                                                |
| `cross_subdomain_cookie`      | boolean | `true`                    | By default the Freshpaint cookie is shared across subdomains. Setting this to false means that users will be tracked separately on each subdomain. This is commonly set to false in complex subdomain patterns to prevent security errors.                                                                                                             |
| `disable_target_text_capture` | boolean | `false`                   | Set this option to true if you don't want autotrack to capture target text properties like `$el_text` and `$el_nested_text`.                                                                                                                                                                                                                           |
| `integrations`                | object  | `{}`                      | Pass a list of integrations that you want to send your events to. This will override your events normal destinations. See the documentation on [event options](#event-options) for details on how this should look.                                                                                                                                    |
| `persistence`                 | string  | `cookie`                  | How Freshpaint's SDK will save user session information. The possible values are `cookie` and `localStorage`.                                                                                                                                                                                                                                          |
| `secure_cookie`               | boolean | `false`                   | Force Freshpaint session cookies to only be transmitted over HTTPS.                                                                                                                                                                                                                                                                                    |
| `session_timeout`             | number  | `1800` (30 minutes)       | The timeout for Freshpaint to start a new session, in seconds. If more than `session_timeout` seconds have passed since the last event was registered in an existing session, Freshpaint will start a new session and generate a new session\_id.                                                                                                      |
| `unload_wait_time`            | number  | `100`                     | The SDK will register an `onUnload` event to wait this number of milliseconds to let any queued events be sent to us and client-side destinations when closing a page with the SDK on it. Increasing this will cause us to wait longer, and maybe capture more events, at the cost of a longer delay before leaving a page.                            |
| `urlTruncLimit`               | number  | `255`                     | The maximum length (in characters) for URL properties `$current_url`, `$referrer`, and `$initial_referrer`  before they are truncated. Accepts a value between `1` and `384`. Values outside this range are ignored and the default of `255` is used. Other event properties are always truncated at 255 characters and are unaffected by this option. |

## Event Options

Each event allows you to pass in a list of integrations to which you want to send your event. This is a great way to conditionally enable or disable an integration while you're experimenting. Here's an example of how it works:

```javascript
freshpaint.track(
  "some-event-name",
  {
    "some_property": 123,
    "$options": {
      integrations: {
        All: false,
        Mixpanel: true,
        Iterable: true
      }
    } 
  }
);
```

There's a couple of interesting properties to highlight here. The first is `All: false`. You can use this to override your event's normal list of destinations, and send to none of them, *except* for `Mixpanel` and `Iterable`, which are both true.

The inverse of this behavior is also possible. Consider the following:

```javascript
{
  All: true,
  Mixpanel: false
}
```

Here, you'll send to every destination *except* Mixpanel.

{% hint style="info" %}
If you have multiple configured instances of a given destination type, you can choose a specific one with a suffix, such as: **Facebook Conversions API::0123456789012345.** The [configuration page](https://app.freshpaint.io/destinations/apps) for the instance shows the full value to use. When no suffix is specified, all configured instances of the destination type are selected for inclusion / exclusion.
{% endhint %}
