# Configuration

Learn about the options accepted by the package.

The package is configured through `config/croct.php`. Only the application ID and API key are required, and everything else has sensible defaults.

Publish the file to customize any option:

```sh
php artisan vendor:publish --tag=croct-config
```

## Options

The following list describes the available options:

- `app_id`: `string`

  The ID of the application.

  Defaults to the `CROCT_APP_ID` environment variable. You can find it on the [Integration page](https://app.croct.com/redirect/organizations/-organization-/workspaces/-workspace-/applications/-application-/integration) of your application.

- `api_key`: `string`

  The API key used to [sign visitor tokens](/explanation/application/signed-tokens).

  Defaults to the `CROCT_API_KEY` environment variable. Keep it out of source control by referencing it through the environment. See [API keys](/explanation/application/api-keys) for more information.

- `base_endpoint_url`: `string` (optional) (default: `null`)

  The base URL for the API calls.

  Override it only for testing, for example to point the SDK at a [mock server](/reference/sdk/laravel/testing#feature-testing).

- `token_duration`: `integer` (optional) (default: `86400`)

  The lifetime of the issued visitor tokens, in seconds.

- `debug`: `boolean` (optional)

  Whether to enable [debug mode](/reference/sdk/javascript/troubleshooting/debugging#enable-debug-mode) on the client-side SDK.

  When unset, it follows your application's debug mode, so it is on in local development. When enabled, the browser SDK logs detailed information to the console.

- `locale`: `object` (optional)

  The settings for detecting the visitor locale.

  See [Locale detection](/reference/sdk/laravel/data-collection#locale) for details.

  - `enabled`: `boolean` (optional) (default: `true`)

    Whether to detect the locale from the request.

  - `default`: `string` (optional) (default: `null`)

    The locale used to serve content.

    It overrides the detected locale, or sets a fixed locale when detection is disabled.

- `cookie`: `object` (optional)

  The settings for the session cookies the SDK writes to the response.

  - `domain`: `string` (optional) (default: `null`)

    The domain for the cookies.

    When unset, the cookies are scoped to the current host.

  - `secure`: `boolean` (optional) (default: `true`)

    Whether to send the cookies only over HTTPS connections.

  - `same_site`: `string` (optional) (default: `none`)

    The SameSite policy for the cookies.

    The following values are supported:

    | Value    | Description                                                                   |
    | -------- | ----------------------------------------------------------------------------- |
    | `strict` | The cookie is sent only to the same site.                                     |
    | `lax`    | The cookie is sent to the same site and to cross-site requests that are safe. |
    | `none`   | The cookie is sent to the same site and to cross-site requests.               |

- `script`: `object` (optional)

  The settings for the client-side SDK loader, which the package injects into HTML responses.

  - `auto_inject`: `boolean` (optional) (default: `true`)

    Whether to inject the loader into HTML responses automatically.

  - `placement`: `string` (optional) (default: `head`)

    The position where the loader is injected.

    The following values are supported:

    | Value  | Description                                    |
    | ------ | ---------------------------------------------- |
    | `head` | The loader is injected into the document head. |
    | `body` | The loader is injected at the end of the body. |

  - `path`: `string|null` (optional) (default: `/_croct/plug.js`)

    The first-party path that serves the SDK from your own domain.

    Set it to `null` to load the SDK from the CDN instead.

  - `mode`: `string` (optional) (default: `defer`)

    The loading strategy for the script.

    The following values are supported:

    | Value   | Description                                                |
    | ------- | ---------------------------------------------------------- |
    | `defer` | Loads in the background and runs after the page is parsed. |
    | `async` | Loads in the background and runs as soon as it is ready.   |
    | `sync`  | Loads and runs immediately, blocking page rendering.       |

- `storyblok`: `object` (optional)

  The settings for the [Storyblok](/reference/sdk/storyblok) integration.

  - `enabled`: `boolean` (optional) (default: `true`)

    Whether to personalize Storyblok content automatically.

    Requires [`croct/plug-storyblok`](https://github.com/croct-tech/plug-storyblok-php) and a bound Storyblok Stories API.
