For the complete documentation index, see llms.txt. This page is also available as Markdown.

Front End Integration

The Spectrum front end is designed to be integrated into the front end of your ecommerce website. All necessary front end files will be delivered via the Spectrum CDN and are rendered dynamically within an HTML element.

1. Load the Spectrum JavaScript file in the HEAD tag

The Spectrum team will provide the full URL to fill in the [ClientHandle]. The [SpectrumCdnEnvironment] base URLs are listed in the Environments page.

<script type="module" src="[SpectrumCdnEnvironment]/[ClientHandle]/frontend/js/customizer.esm.js"/>

2. Create an HTML div tag with an ID of spectrum-customizer

This is where the customizer experience will load on the page. Any surrounding container elements on the PDP should be 100% width to allow for responsive content.

<div id="spectrum-customizer"></div>

3. Relaunching the Customizer

The customizer will launch automatically on first load and set a relaunch function to window.spectrumInitializeCustomizer. If the customizer is closed by the user (or via the add to cart flow), you can relaunch it by calling await window.spectrumInitializeCustomizer(). Ensure that the id=“spectrum-customizer” div exists and window variables are updated as needed before relaunching.

Last updated

Was this helpful?