Contentful Personalization & Analytics
    Preparing search index...
    • Attaches the ContentfulOptimization preview panel to the DOM as a Web Component.

      Registers all custom elements, fetches audiences and optimization entries from Contentful, wires up state interceptors, and appends the panel to document.body. Calling this function more than once reuses the existing in-flight or completed attachment.

      Type Parameters

      • M extends ChainModifiers = ChainModifiers

      Parameters

      Returns Promise<void>

      Resolves once the panel has been appended to the document body.

      Error if no Optimization Web SDK instance can be resolved.

      Error if optimization states cannot be obtained during registration.

      import attachOptimizationPreviewPanel from '@contentful/optimization-web-preview-panel'

      await attachOptimizationPreviewPanel({ contentful: client, nonce: undefined })