Contentful Personalization & Analytics
    Preparing search index...

    Configuration options for the ContentfulOptimization Web SDK.

    Extends CoreStatefulConfig with Web-specific options such as the application descriptor and automatic tracked entry interactions.

    interface OptimizationWebConfig {
        allowedEventTypes?: EventType[];
        api?: CoreApiConfig;
        app?: { name: string; version: string };
        autoTrackEntryInteraction?: Partial<
            Record<keyof EntryInteractionTrackers, boolean>,
        >;
        clientId: string;
        cookie?: CookieAttributes;
        defaults?: CoreConfigDefaults;
        environment?: string;
        eventBuilder?: EventBuilderConfig;
        fetchOptions?: Omit<ProtectedFetchMethodOptions, "apiName">;
        getAnonymousId?: () => string | undefined;
        logLevel?: LogLevels;
        onEventBlocked?: (event: BlockedEvent) => void;
        queuePolicy?: QueuePolicy;
    }

    Hierarchy (View Summary)

    Index

    Properties

    allowedEventTypes?: EventType[]

    Allow-listed event type strings permitted when consent is not set.

    Unified API configuration used by Experience and Insights clients.

    app?: { name: string; version: string }

    Application metadata used to identify the Web app in downstream events.

    Type Declaration

    • name: string

      Name of the application.

    • version: string

      Version of the application.

    autoTrackEntryInteraction?: Partial<
        Record<keyof EntryInteractionTrackers, boolean>,
    >

    Controls automatic tracking behavior for entry interactions.

    Supports entry interactions via the views, clicks, and hovers interactions.

    { views: false, clicks: false, hovers: false }

    clientId: string

    Client identifier used for authentication or tracking.

    Cookie configuration used for persisting the anonymous identifier.

    Use this to control the cookie domain and expiration.

    Optional set of default values applied on initialization.

    environment?: string

    Contentful environment identifier.

    'main'

    eventBuilder?: EventBuilderConfig

    Event builder configuration (channel/library metadata, etc.).

    fetchOptions?: Omit<ProtectedFetchMethodOptions, "apiName">

    Options used to configure the underlying protected fetch method.

    apiName is derived from the client name and must not be provided here.

    getAnonymousId?: () => string | undefined

    Function used to obtain an anonymous user identifier.

    logLevel?: LogLevels

    Minimum log level for the default console sink.

    onEventBlocked?: (event: BlockedEvent) => void

    Callback invoked whenever an event call is blocked by checks.

    queuePolicy?: QueuePolicy

    Unified queue policy for queued stateful work.