Contentful Personalization & Analytics
    Preparing search index...

    Props for the OptimizationRoot component.

    Accepts all CoreStatefulConfig properties directly. Only clientId is required.

    interface OptimizationRootProps {
        allowedEventTypes?: EventType[];
        analytics?: CoreStatefulAnalyticsConfig;
        children: ReactNode;
        clientId: string;
        defaults?: CoreConfigDefaults;
        environment?: string;
        eventBuilder?: EventBuilderConfig;
        fetchOptions?: Omit<ProtectedFetchMethodOptions, "apiName">;
        getAnonymousId?: () => string | undefined;
        liveUpdates?: boolean;
        logLevel?: LogLevels;
        onEventBlocked?: (event: BlockedEvent) => void;
        personalization?: CoreStatefulPersonalizationConfig;
        previewPanel?: PreviewPanelConfig;
        trackEntryInteraction?: Partial<Record<EntryInteraction, boolean>>;
    }

    Hierarchy (View Summary)

    Index

    Properties

    allowedEventTypes?: EventType[]

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

    Configuration for the analytics (Insights) API client plus stateful queue behavior.

    children: ReactNode

    Children components that will have access to the Optimization instance.

    clientId: string

    Client identifier used for authentication or tracking.

    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.

    liveUpdates?: boolean

    Whether Personalization components should react to state changes in real-time.

    false

    Live updates are always enabled when the preview panel is open, regardless of this setting.

    logLevel?: LogLevels

    Minimum log level for the default console sink.

    onEventBlocked?: (event: BlockedEvent) => void

    Callback invoked whenever an event call is blocked by checks.

    Configuration for the personalization (Experience) API client plus stateful queue behavior.

    previewPanel?: PreviewPanelConfig

    Optional configuration for the preview panel. When provided with enabled: true, the preview panel will be available.

    trackEntryInteraction?: Partial<Record<EntryInteraction, boolean>>

    Controls which entry interactions are tracked automatically for all Personalization and Analytics components. Individual components can override each interaction type with their trackViews and trackTaps props.

    { views: true, taps: false }

    Mirrors the web SDK's autoTrackEntryInteraction pattern. Uses taps instead of clicks to match React Native terminology.

    <OptimizationRoot
    instance={optimization}
    trackEntryInteraction={{ views: true, taps: true }}
    >
    <App />
    </OptimizationRoot>