Integration Overview
This section describes how to integrate DIVA into your website or webshop: from the first click on "Configure", to saving a configuration, reopening it later and, optionally, adding it to your cart.
DIVA is embedded with widgets: you load one script and mark up HTML elements with data-diva-* attributes. No JavaScript initialization code and no version management are required, so the integration works in any CMS (WordPress, Joomla, …) as well as in a webshop.
The big picture
Every DIVA integration follows the same lifecycle. Steps 1 to 3 are the basis of every integration, step 4 is optional and only needed if DIVA is connected to your webshop cart.
Two identifiers carry the whole process:
productId: identifies a base product in DIVA. It is used to start a new configuration.divaNr: identifies a saved configuration (e.g.DIVA-12345-1, configurationDIVA-12345in version 1). It is used to reopen a configuration, to fetch it from the DIVA API and to reference it in your cart.
Pages on your website
The lifecycle above touches up to three places on your website:
| Page | Purpose | Guide |
|---|---|---|
| Product or landing page | Starts a new configuration via a "Configure" button, optionally shows the product media | Start a New Configuration, Product Detail Page |
| Configuration page | Reopens a saved configuration from the link in the PDF. Required in every integration | Reopen a Saved Configuration |
| Cart page | Lists the configured products, lets the user edit them or open the PDF (optional) | Add to Cart |
Language
All widgets are available in German (de), French (fr), Italian (it) and English (en). Set the language with the data-lang attribute on the widget element:
<div data-diva-widget-type="diva-configurator-button" data-diva-param-productid="<PRODUCT_ID>" data-lang="fr">Configurer</div>
Each widget determines its language once when the page loads, in this order:
data-langon the widget elementlangparameter of the widget script URL, e.g..../integration/api/widget/<YOUR_ORGANIZATION_ID>?lang=frlangattribute of your page, e.g.<html lang="fr-CH">- Language of the visitor's browser
- German
A step only counts if it results in one of the four supported languages; otherwise the next step is used. The region part is ignored, so fr-CH becomes fr. Parameters in the URL of your page (e.g. ?lang=fr) are not evaluated.
On a multilingual website it is usually enough to set the lang attribute of your page correctly. Use data-lang if a single widget should differ from the page language.
What will be provided
Along with this documentation, Crystal Design provides the project-specific values required for the integration:
- Demo link: a minimal implementation of your use case that can be used as a starting point
- E-Mail with specific instructions: additional explanations for your specific use case
organizationId: the unique DIVA organization identifier- DIVA API host: the host of the widget script and the DIVA API (
<your-diva-api-host>in this documentation) - Product IDs: the DIVA product identifiers that must be mapped to your products
apiKey: a secure key for your backend to fetch saved configurations (cart integration only)
Configurator
Start a new configuration or reopen a saved one
Cart Integration
Add DIVA configurations to your webshop cart
Product Detail Page
Show the images, 3D model and AR view of a DIVA product on your product detail page.
Migrating from the Web Component
Replace an existing diva-framework Web Component integration with the DIVA widgets.