Install diagnostics and quizzes
<humind-quiz> walks a visitor through a few questions, one at a time. You build it in your dashboard, under Diagnostics & quizzes, and it can be two things:
- A quiz: it ends on a product recommendation, among the products of one collection or across your whole catalog.
- A diagnostic: a questionnaire that ends on a screen of your own (a thank-you message, a button to a page), with no recommendation. The answers are saved in your dashboard.
Both are the same widget and install the same way. This page covers where to put it and how it opens. The questions themselves are written in the dashboard: nothing to code.

Whitelist your domain first
Humind only renders on domains whitelisted in your dashboard's URL whitelist page. Add every environment you embed on (prod, staging, preview, etc.).
Before you start
- Create the quiz or diagnostic in Diagnostics & quizzes and switch it on. A quiz that is switched off shows nothing on your site.
- Copy its Quiz ID from the side panel of the quiz.
- Copy your Company ID from the Developer Credentials page. On Shopify the shop domain replaces it, and the theme blocks fill it in for you.
The two lines
Every integration is the same two lines: the script, once per page, and the tag where the quiz goes.
<script src="https://widgets.thehumind.com/v1/loader.js" defer></script>
<humind-quiz
quiz-id="YOUR_QUIZ_ID"
company-id="YOUR_COMPANY_ID"
language="en"
></humind-quiz>What changes from one integration to the next is the display-mode attribute: see the three display modes.
The three display modes
One tag, three modes. Two of them put the quiz in the page, where the tag is, like any other block of it. The third keeps it over the page: closed until it is asked for, then covering everything.
| In the page, as a card | In the page, full size | Over the page, on demand | |
|---|---|---|---|
display-mode | compact (default) | page | overlay |
| Where the quiz is | In the flow of the page | In the flow of the page | Above the page, covering it |
| On arrival, the visitor sees | The quiz, as a card | The quiz in full size, right away | Nothing of the quiz |
| Room taken | The width of its container | What the screen has left: under your header if the page has one, the whole screen if it has nothing else | None, then the whole screen |
| The quiz starts | Collapsed, as a short teaser with a start button (open on a computer if you turned on "Open quiz by default") | On the first question | On a click on an element of your page, or by a link ending in ?humind=quiz |
| Your site around it | Stays visible | Stays: your header above, your footer below | Covered during the quiz, given back when it closes |
| The recommendation shows | In place, under the questions | In the chat widget | In the chat widget |
| Shopify theme block | Quiz | None | Quiz button |
| Use it for | A collection page, a landing page, an article | A page dedicated to the quiz, reached by its own address | A button anywhere on your site, a link in a newsletter, a QR code |
The examples below run the real widget on a built-in sample quiz, with no backend call.
In the page, as a card (compact)
The default. The quiz is a card where the tag is, and takes the width of its container. It starts as a short teaser with a start button. On a computer it starts open only if you turned on Open quiz by default in the quiz settings of your dashboard, or if the tag carries start-expanded="true"; on a phone it always starts as the teaser.
<humind-quiz
quiz-id="YOUR_QUIZ_ID"
company-id="YOUR_COMPANY_ID"
language="en"
></humind-quiz>In the page, full size (page)
One question at a time, centered, with a progress bar along the top of the quiz. The quiz is in the flow of the page, like any other block: what you put above it stays above, what you put below follows it. It takes what the screen has left under your header. On a page that has nothing else, that is the whole screen.
Put the tag on a page of its own: the address of that page is the link you share. The frame below is such a page, with a header and a footer:
<humind-quiz
display-mode="page"
quiz-id="YOUR_QUIZ_ID"
company-id="YOUR_COMPANY_ID"
language="en"
></humind-quiz>- Nothing to configure: the quiz measures what stands above it. It is never shorter than 480px, and a tag placed lower than half a screen takes a whole screen, since the visitor scrolls to it.
- A header that is
position: fixedtakes no room in the page, so give the quiz a wrapper with apadding-topof the header's height. page-image-urladds a picture beside the questions on wide screens.
Over the page, on demand (overlay)
The quiz is on the page, closed: it shows nothing and downloads nothing. When it is opened it is not part of the page: it lies over it, full screen, whatever the page contains and wherever the visitor has scrolled, with a close button that gives the page back. The tag can sit on every page of your site.
<humind-quiz
display-mode="overlay"
trigger=".open-quiz"
quiz-id="YOUR_QUIZ_ID"
company-id="YOUR_COMPANY_ID"
language="en"
></humind-quiz>
<button class="open-quiz">Find my product</button>Three ways to open it:
| Way | How |
|---|---|
| An element of your page | trigger takes a CSS selector. A click on any element that matches opens the quiz. The button is yours, with your classes and your design; a link used this way is not followed, except with Ctrl, Cmd or Shift, which keep their new tab. A selector that takes the whole page (*, body) is ignored. |
| A link | Add ?humind=quiz to the address of any page that carries the tag: https://your-site.com/any-page?humind=quiz. |
| Your code | window.HumindWidgets.openQuiz(). See JavaScript API. |
Without trigger, the quiz is reachable by the link, or by your code, only: nothing of it shows on your site.
Give trigger a selector of your own (a class, an id). A broad one such as button turns every button of the page into an opener, those of other widgets included.
If the Humind script is already on your site, change its address to https://widgets.thehumind.com/v1/loader.js?v=2 when you add your first overlay quiz: a browser that kept an older copy of the script does not know this mode.
About the link:
- It opens a quiz only if a closed quiz of the page is that quiz. A link cannot show a quiz you did not put on the page.
- With several closed quizzes on one page, name the one to open:
?humind=quiz&humind_quiz=YOUR_QUIZ_ID. Without it the first one of the page opens. The name is compared with thequiz-idattribute, so a tag that loads its quiz bycollection-idcannot be named: it can only be the first. - It opens once per browser tab: a reload, or the next page of a site that carries the query string along, does not open the quiz again.
- A quiz that is switched off shows nothing: the overlay closes as soon as the server answers that there is no quiz.
humindis the parameter the chat widget reads too (?humind=chat). Each widget ignores the other's values.
The quiz closes on its close button, on Escape (which first closes a picture opened inside the quiz), when the visitor goes back past the first question, and when the recommendation is handed over to the chat. Each opening starts a fresh quiz.
Which quiz to load
| Attributes | Loads | |
|---|---|---|
| By quiz | quiz-id | That quiz, on any page. The only way to show a diagnostic, or a quiz that recommends across the whole catalog. |
| By collection | collection-id + integration | The quiz linked to that collection. One tag on a collection template covers every collection that has a quiz. |
quiz-id wins when both are set.
Choose your integration path
- Pure Shopify merchant: use a theme block. No HTML to copy. See Shopify theme blocks.
- Non-Shopify store (PrestaShop, WooCommerce, Magento, custom stack, any headless storefront without a Shopify backend): paste the two lines. See Non-Shopify: copy-paste.
- Hybrid: Shopify backend + headless storefront: paste the two lines with
integration="shopify". See Headless Shopify hybrid.
Shopify theme blocks
Two theme app blocks map to this widget. Both work on any template and say which quiz to show the same way:
- Quiz ID (optional setting): paste the ID from your dashboard to show that quiz. It is the only way to place a diagnostic, or a quiz with no collection.
- Collection (when no ID is set): on a collection page the current collection is used, so one block on the collection template covers your whole catalog. On any other page, pick the collection in the block's settings.
Nothing renders on the storefront when neither resolves; the theme editor shows a hint instead.
Quiz (inline)
The quiz in compact mode, where you drop the block. The block has no label setting: the texts of the quiz follow the storefront language. Its look is set in your dashboard ("Customize the widget"), except the card surface, which the block can override for a page whose background calls for it.
Quiz button (full screen)
A button styled from the theme editor (label, colors, corner radius, size, alignment), and a quiz in overlay mode that the button opens. A link to the page ending in ?humind=quiz opens it too.
Non-Shopify: copy-paste
<script src="https://widgets.thehumind.com/v1/loader.js" defer></script>
<humind-quiz
quiz-id="YOUR_QUIZ_ID"
company-id="YOUR_COMPANY_ID"
language="en"
></humind-quiz>To load the quiz of a collection instead, replace quiz-id with the collection and your platform:
<humind-quiz
collection-id="summer-2026"
integration="custom"
company-id="YOUR_COMPANY_ID"
language="en"
></humind-quiz>integration: one ofshopify,supersmart,custom,prestashop,playground. Usecustomfor anything not explicitly named (WooCommerce, Magento, bespoke stacks…).prestashopresolves the same collections ascustom, within your company.collection-id: the ID of the collection you synced into Humind. See Custom catalog integration for the sync.
Headless Shopify hybrid
Shopify backend, but your storefront is not a Shopify theme (Hydrogen, Next.js, Nuxt, etc.). Paste the two lines and keep integration="shopify": the widget calls /cart/add.js on your storefront origin for add-to-cart.
<script src="https://widgets.thehumind.com/v1/loader.js" defer></script>
<humind-quiz
collection-id="summer-2026"
integration="shopify"
shop-domain="store.myshopify.com"
language="en"
></humind-quiz>collection-id accepts any of:
- A Shopify collection handle (e.g.
summer-2026) - A Shopify GID (e.g.
gid://shopify/Collection/12345) - An internal Humind ID (24-char hex)
With quiz-id, drop collection-id: integration="shopify" and shop-domain stay.
What a quiz can contain
Everything below is set in the dashboard editor and drawn by the widget. Listed here so you know what your page will show.
| Step | What the visitor does |
|---|---|
| List of choices | Picks one or several answers. Answers can carry pictures, sit side by side or one per line, and include a free "Other" answer. |
| Dropdown | Picks one entry of a closed list. |
| Rating scale | Picks a point: numbers, stars or faces, with optional end labels. |
| Ranking | Drags the answers into order of preference. |
| Grid | Picks one column on each row. |
| Text | Types a short or a long answer. |
| Number / slider | Types a value with its unit, or drags a slider. |
| Photo | Adds pictures (JPEG, PNG or WebP). |
| Information screen | Reads a title, a text and a picture, then continues. |
| End screen | The quiz stops there, with a text and an optional button to a page of your choice. |
Also set per step: a description under the question, a picture above it, whether an answer is required, and conditions that show a step only after given answers.
A "your details" step (a short contact form) can be added before the results, from the quiz settings.
Saved answers and URL parameters
Each run is saved as the visitor goes, and shows in the Answers tab of the quiz, including the runs left half-way.
If you list parameter names in the quiz settings (for example utm_source or panel_id), the widget reads their values from the address of the page it is on (https://your-site.com/quiz?panel_id=A12) and saves them with the run. Only the names you listed are read.
Where the results are shown
| The quiz ends on | compact | page and overlay |
|---|---|---|
| A recommendation | In place, under the questions: a carousel of products and a short text | In the Humind chat widget, which opens on the quiz conversation with the product page, the variant picker, the cart and a conversation to continue |
| An end screen | The end screen, in the card | The end screen, full screen |
In page and overlay, if the chat widget (<humind-widget>) is not on the page, the recommendation is shown in the quiz itself: the path never dead-ends.
Attributes
Which quiz
| Attribute | Type | Purpose |
|---|---|---|
quiz-id | string | The quiz's own ID, from the dashboard. Pass "mock" for an offline demo. |
collection-id | string | Without quiz-id: Shopify handle/GID, or the external ID you pushed for this integration via the catalog API. |
integration | 'shopify' | 'supersmart' | 'custom' | 'prestashop' | 'playground' | Required with collection-id. Must match the value used when the collection was synced (prestashop also reads custom, within your company). The backend rejects any other value with 400. |
Identity
| Attribute | Type | Default | Purpose |
|---|---|---|---|
company-id | string | - | Recommended for non-Shopify merchants. Your Humind company ID from the Developer Credentials page. Takes priority over shop-domain. |
shop-domain | string | - | Alternative to company-id. Matched against the domains registered on your company (protocol stripped, exact match). Standard choice on Shopify. |
market-key | string | - | Multimarket setups only: names the market when several markets share the same domain (required then, ignored on a single-market domain). Set automatically on Shopify. Same behavior as the chat widget: see several markets on one domain. |
language | string | fr | ISO 639-1 code. Sets the language of the questions and of every default label. Supported: en, fr, de, es, it, nl, pt, ru, ar, he, zh. |
is-playground | boolean attr | false | Marks the session as playground (disables prod analytics). Accepts "", "true" or true. |
Display
| Attribute | Type | Default | Purpose |
|---|---|---|---|
display-mode | 'compact' | 'page' | 'overlay' | compact | See The three display modes. |
trigger | CSS selector | - | overlay mode only. The elements of your page that open the quiz. |
page-image-url | string | - | page and overlay modes. URL of a picture shown beside the questions on wide screens. |
start-expanded | 'true' | 'false' | dashboard | compact mode. Overrides the "Open quiz by default" setting of the quiz for this tag: true starts open on a computer, false always starts on the teaser. |
Labels (i18n overrides)
Every visitor-facing string follows language. A label attribute overrides the translation and pins that text in one language, whatever the language of the page: on a multilingual storefront, omit the attribute or give it a value per language yourself. That is why the Shopify theme blocks send no label attribute.
| Attribute | Default (en) |
|---|---|
start-label | Start Quiz |
loading-label | Loading quiz... |
other-label | Other |
continue-label | Continue |
type-answer-placeholder | Type your answer... |
step-analyzing-label | Analyzing your answers... |
step-searching-label | Searching products... |
step-found-label | Products found! |
step-writing-label | Writing recommendation... |
agent-name | The name of your assistant, else AI Assistant |
ai-assistant-label | AI Assistant |
add-to-cart-label | Add to cart |
add-to-cart-error-label | Try again |
view-product-label | View product |
Appearance
The look of the quiz is set in your dashboard, in Diagnostics & quizzes ("Customize the widget"): card surface, fonts, sizes, colors, buttons, answers. It is served with the quiz, so every tag shows it.
Each setting also exists as an attribute, which overrides the dashboard for that tag only:
| Group | Attributes |
|---|---|
| Card | card-background (white, light, primary, custom, transparent), card-background-color, card-border, card-radius-px, density (compact, regular, spacious) |
| Assistant line | logo-url, show-logo, identity-mark (logo, star), identity-badge, identity-style (default, eyebrow), identity-color, identity-star-color, identity-font, identity-font-family |
| Question | heading-font (default, site, custom), heading-font-family, heading-size-px, heading-weight (regular, medium, bold), heading-uppercase, heading-color |
| Text | body-font, body-font-family, body-color, teaser-description, description-italic, description-size-px |
| Buttons | cta-background-color, cta-text-color, cta-border-color, cta-radius-px, cta-weight, cta-uppercase, cta-font, cta-font-family |
| Answers | option-background-color, option-text-color, option-border-color, option-radius-px, option-selected-background-color, option-selected-text-color |
Colors are #rrggbb. A font value of site takes the font of your page around the tag; custom takes the family you name, which your page must already load.
For what the settings cannot express, the quiz exposes part names that a stylesheet of your page can target:
humind-quiz::part(card) { box-shadow: 0 12px 40px rgba(0, 0, 0, .08); }
humind-quiz::part(question) { font-family: 'Oswald', sans-serif; }
humind-quiz::part(cta) { border-radius: 0; }| Part | Element |
|---|---|
card | The card |
progress | The progress track |
identity, identity-label, identity-mark | The assistant line, its label, its star |
question | The question |
question-image | The picture of a question |
body | The description under a question, the text of an information or end screen |
description | The line under the first question on the collapsed teaser |
option | The answers |
cta | The Start and Continue buttons, the button of an end screen |
Events
| Event | Target | When |
|---|---|---|
quiz-open, quiz-close | <humind-quiz> element | overlay mode. The quiz was opened, was closed. Both bubble. |
page-back | <humind-quiz> element | page mode. The visitor went back past the first question. |
results-in-chat | <humind-quiz> element | page mode. The recommendation was handed over to the chat widget. Detail: { threadId, threadToken }. |
quiz-unavailable | <humind-quiz> element | page mode. The server has no quiz to show (switched off, not found). |
humind-continue-thread | window | The quiz asks the chat widget to open on its conversation. Detail: { threadId, threadToken, isPlayground? }. |
cart:updated | document | After a successful add to cart on Shopify or PrestaShop; detail.cart is the platform's own cart object (on PrestaShop, read it defensively: some answers carry no cart). On Shopify, see Keep your theme's cart in sync. |
humind-cart-error | document | An add to cart was refused. detail.code says why (out_of_stock, selection_required, network_error…). |
In overlay mode the quiz handles page-back, results-in-chat and quiz-unavailable itself: it closes. Listen to them only if you mount a page quiz in a surface of your own.
JavaScript API
The loader exposes window.HumindWidgets and dispatches humind-widgets-ready on window once it is there.
// Opens the first closed quiz of the page (display-mode="overlay").
// Resolves false when the page has none.
window.HumindWidgets.openQuiz();
// Opens the one with this quiz ID.
window.HumindWidgets.openQuiz('YOUR_QUIZ_ID');
// Closes the quiz that is open, if any.
window.HumindWidgets.closeQuiz();If your code may run before the loader:
function openQuiz() {
window.HumindWidgets.openQuiz();
}
if (window.HumindWidgets) openQuiz();
else window.addEventListener('humind-widgets-ready', openQuiz, { once: true });Mock mode
Pass quiz-id="mock" to render a hard-coded sample quiz without hitting the backend. Useful for styling, in any display mode.
<humind-quiz quiz-id="mock" integration="playground"></humind-quiz>