Skip to main content

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, configuration DIVA-12345 in 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:

PagePurposeGuide
Product or landing pageStarts a new configuration via a "Configure" button, optionally shows the product mediaStart a New Configuration, Product Detail Page
Configuration pageReopens a saved configuration from the link in the PDF. Required in every integrationReopen a Saved Configuration
Cart pageLists 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:

  1. data-lang on the widget element
  2. lang parameter of the widget script URL, e.g. .../integration/api/widget/<YOUR_ORGANIZATION_ID>?lang=fr
  3. lang attribute of your page, e.g. <html lang="fr-CH">
  4. Language of the visitor's browser
  5. 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)