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:

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 of your application.

api_key
string

The API key used to sign visitor tokens.

Defaults to the CROCT_API_KEY environment variable. Keep it out of source control by referencing it through the environment. See API keys for more information.

base_endpoint_url(optional)
string

The base URL for the API calls.

Override it only for testing, for example to point the SDK at a mock server.

Default:null
token_duration(optional)
integer

The lifetime of the issued visitor tokens, in seconds.

Default:86400
debug(optional)
boolean

Whether to 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(optional)
object

The settings for detecting the visitor locale.

See Locale detection for details.

enabled(optional)
boolean

Whether to detect the locale from the request.

Default:true
default(optional)
string

The locale used to serve content.

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

Default:null

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

domain(optional)
string

The domain for the cookies.

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

Default:null
secure(optional)
boolean

Whether to send the cookies only over HTTPS connections.

Default:true
same_site(optional)
string

The SameSite policy for the cookies.

The following values are supported:

ValueDescription
strictThe cookie is sent only to the same site.
laxThe cookie is sent to the same site and to cross-site requests that are safe.
noneThe cookie is sent to the same site and to cross-site requests.
Default:none
script(optional)
object

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

auto_inject(optional)
boolean

Whether to inject the loader into HTML responses automatically.

Default:true
placement(optional)
string

The position where the loader is injected.

The following values are supported:

ValueDescription
headThe loader is injected into the document head.
bodyThe loader is injected at the end of the body.
Default:head
path(optional)
string|null

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

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

Default:/_croct/plug.js
mode(optional)
string

The loading strategy for the script.

The following values are supported:

ValueDescription
deferLoads in the background and runs after the page is parsed.
asyncLoads in the background and runs as soon as it is ready.
syncLoads and runs immediately, blocking page rendering.
Default:defer
storyblok(optional)
object

The settings for the Storyblok integration.

enabled(optional)
boolean

Whether to personalize Storyblok content automatically.

Requires croct/plug-storyblok and a bound Storyblok Stories API.

Default:true