Contentful Personalization & Analytics
    Preparing search index...
    • Provides the ContentfulOptimization instance to all child components via React Context.

      Handles SDK initialization, loading state, and cleanup internally. Children are not rendered while provider-owned SDK initialization is pending.

      Parameters

      Returns Element | null

      null while initialization is pending, then a context provider for ready or error state

      Config is captured on first render, except locale, which updates the SDK live. To force full re-initialization, change the React key prop.

      Prefer using OptimizationRoot instead, which wraps this provider with additional functionality such as live updates and the preview panel.

      <OptimizationProvider clientId="your-client-id" environment="main">
      <App />
      </OptimizationProvider>