Skip to content

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.

Quiz preview

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 ​

  1. Create the quiz or diagnostic in Diagnostics & quizzes and switch it on. A quiz that is switched off shows nothing on your site.
  2. Copy its Quiz ID from the side panel of the quiz.
  3. 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.

html
<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 cardIn the page, full sizeOver the page, on demand
display-modecompact (default)pageoverlay
Where the quiz isIn the flow of the pageIn the flow of the pageAbove the page, covering it
On arrival, the visitor seesThe quiz, as a cardThe quiz in full size, right awayNothing of the quiz
Room takenThe width of its containerWhat the screen has left: under your header if the page has one, the whole screen if it has nothing elseNone, then the whole screen
The quiz startsCollapsed, as a short teaser with a start button (open on a computer if you turned on "Open quiz by default")On the first questionOn a click on an element of your page, or by a link ending in ?humind=quiz
Your site around itStays visibleStays: your header above, your footer belowCovered during the quiz, given back when it closes
The recommendation showsIn place, under the questionsIn the chat widgetIn the chat widget
Shopify theme blockQuizNoneQuiz button
Use it forA collection page, a landing page, an articleA page dedicated to the quiz, reached by its own addressA 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.

html
<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:

html
<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: fixed takes no room in the page, so give the quiz a wrapper with a padding-top of the header's height.
  • page-image-url adds 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.

html
<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:

WayHow
An element of your pagetrigger 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 linkAdd ?humind=quiz to the address of any page that carries the tag: https://your-site.com/any-page?humind=quiz.
Your codewindow.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 the quiz-id attribute, so a tag that loads its quiz by collection-id cannot 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.
  • humind is 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 ​

AttributesLoads
By quizquiz-idThat quiz, on any page. The only way to show a diagnostic, or a quiz that recommends across the whole catalog.
By collectioncollection-id + integrationThe 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 ​

  1. Pure Shopify merchant: use a theme block. No HTML to copy. See Shopify theme blocks.
  2. Non-Shopify store (PrestaShop, WooCommerce, Magento, custom stack, any headless storefront without a Shopify backend): paste the two lines. See Non-Shopify: copy-paste.
  3. 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 ​

html
<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:

html
<humind-quiz
  collection-id="summer-2026"
  integration="custom"
  company-id="YOUR_COMPANY_ID"
  language="en"
></humind-quiz>
  • integration: one of shopify, supersmart, custom, prestashop, playground. Use custom for anything not explicitly named (WooCommerce, Magento, bespoke stacks…). prestashop resolves the same collections as custom, 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.

html
<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.

StepWhat the visitor does
List of choicesPicks one or several answers. Answers can carry pictures, sit side by side or one per line, and include a free "Other" answer.
DropdownPicks one entry of a closed list.
Rating scalePicks a point: numbers, stars or faces, with optional end labels.
RankingDrags the answers into order of preference.
GridPicks one column on each row.
TextTypes a short or a long answer.
Number / sliderTypes a value with its unit, or drags a slider.
PhotoAdds pictures (JPEG, PNG or WebP).
Information screenReads a title, a text and a picture, then continues.
End screenThe 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 oncompactpage and overlay
A recommendationIn place, under the questions: a carousel of products and a short textIn 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 screenThe end screen, in the cardThe 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 ​

AttributeTypePurpose
quiz-idstringThe quiz's own ID, from the dashboard. Pass "mock" for an offline demo.
collection-idstringWithout 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 ​

AttributeTypeDefaultPurpose
company-idstring-Recommended for non-Shopify merchants. Your Humind company ID from the Developer Credentials page. Takes priority over shop-domain.
shop-domainstring-Alternative to company-id. Matched against the domains registered on your company (protocol stripped, exact match). Standard choice on Shopify.
market-keystring-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.
languagestringfrISO 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-playgroundboolean attrfalseMarks the session as playground (disables prod analytics). Accepts "", "true" or true.

Display ​

AttributeTypeDefaultPurpose
display-mode'compact' | 'page' | 'overlay'compactSee The three display modes.
triggerCSS selector-overlay mode only. The elements of your page that open the quiz.
page-image-urlstring-page and overlay modes. URL of a picture shown beside the questions on wide screens.
start-expanded'true' | 'false'dashboardcompact 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.

AttributeDefault (en)
start-labelStart Quiz
loading-labelLoading quiz...
other-labelOther
continue-labelContinue
type-answer-placeholderType your answer...
step-analyzing-labelAnalyzing your answers...
step-searching-labelSearching products...
step-found-labelProducts found!
step-writing-labelWriting recommendation...
agent-nameThe name of your assistant, else AI Assistant
ai-assistant-labelAI Assistant
add-to-cart-labelAdd to cart
add-to-cart-error-labelTry again
view-product-labelView 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:

GroupAttributes
Cardcard-background (white, light, primary, custom, transparent), card-background-color, card-border, card-radius-px, density (compact, regular, spacious)
Assistant linelogo-url, show-logo, identity-mark (logo, star), identity-badge, identity-style (default, eyebrow), identity-color, identity-star-color, identity-font, identity-font-family
Questionheading-font (default, site, custom), heading-font-family, heading-size-px, heading-weight (regular, medium, bold), heading-uppercase, heading-color
Textbody-font, body-font-family, body-color, teaser-description, description-italic, description-size-px
Buttonscta-background-color, cta-text-color, cta-border-color, cta-radius-px, cta-weight, cta-uppercase, cta-font, cta-font-family
Answersoption-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:

css
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; }
PartElement
cardThe card
progressThe progress track
identity, identity-label, identity-markThe assistant line, its label, its star
questionThe question
question-imageThe picture of a question
bodyThe description under a question, the text of an information or end screen
descriptionThe line under the first question on the collapsed teaser
optionThe answers
ctaThe Start and Continue buttons, the button of an end screen

Events ​

EventTargetWhen
quiz-open, quiz-close<humind-quiz> elementoverlay mode. The quiz was opened, was closed. Both bubble.
page-back<humind-quiz> elementpage mode. The visitor went back past the first question.
results-in-chat<humind-quiz> elementpage mode. The recommendation was handed over to the chat widget. Detail: { threadId, threadToken }.
quiz-unavailable<humind-quiz> elementpage mode. The server has no quiz to show (switched off, not found).
humind-continue-threadwindowThe quiz asks the chat widget to open on its conversation. Detail: { threadId, threadToken, isPlayground? }.
cart:updateddocumentAfter 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-errordocumentAn 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.

js
// 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:

js
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.

html
<humind-quiz quiz-id="mock" integration="playground"></humind-quiz>

Released under the proprietary Humind license.