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

      Registers all custom elements, fetches audiences and personalizations from Contentful, wires up state interceptors, and appends the panel to document.body.

      Parameters

      • args: AttachOptimizationPreviewPanelArgs

        Configuration containing the Contentful client, Optimization instance, and optional CSP nonce.

      Returns Promise<void>

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

      Error if the preview panel has already been attached.

      Error if optimization states cannot be obtained during registration.

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

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