Documentation Index
Fetch the complete documentation index at: https://docs.hemsy.ai/llms.txt
Use this file to discover all available pages before exploring further.
Script Setup
.hemsy-launcher when multiple elements should open Hemsy. Avoid reusing the same id on multiple elements.
Any element matching data-hemsy-selector becomes a Hemsy launcher. The launch behavior is decided per element from attributes on that exact clicked element.
Required Attributes
data-hemsy-subdomain: Your Hemsy store subdomain. Formystore.hemsy.ai, use"mystore".data-hemsy-selector: CSS selector for elements that should launch Hemsy.
Script Attributes Reference
| Attribute | Required | Example | Description |
|---|---|---|---|
data-hemsy-subdomain | true | "mystore" | Your Hemsy store subdomain. |
data-hemsy-selector | true | ".hemsy-launcher" | CSS selector for elements that launch Hemsy. |
data-hemsy-anonymous-id | false | "visitor-42" | Anonymous visitor ID passed through to Hemsy for analytics and order metadata. |
Launcher Attributes
Attach these to any element matchingdata-hemsy-selector.
| Attribute | Example | Description |
|---|---|---|
data-hemsy-auto-product-context | "true" | Auto-builds a closet payload from the current PDP variant. Falls back to scratch if no variant is detected. |
data-hemsy-closet | "eyJwcm9k..." | Explicit URL-safe base64 closet payload. Use this for bundles or curated looks. |
data-hemsy-flow | "<flowId>" | Adds a guided flow to the launch. Must be on the clicked launcher element. |
Mode Resolution
Evaluated per clicked element, in this order:data-hemsy-auto-product-context="true": closet mode with a synthesized product payload, or scratch if no product variant is detected.data-hemsy-closet="<base64>": closet mode with that exact payload.- Nothing else: scratch mode.
data-hemsy-flow composes with any of the above. A flow-only launcher opens scratch mode with the flow applied.
Examples
Scratch Launcher
PDP Launcher
Flow Launcher
Bundle Launcher
Closet Payload
| Field | Required | Type | Notes |
|---|---|---|---|
products | true | Array<object> | Must contain at least 1 product. |
products[].variantId | false | number | string | Preferred identifier and most reliable. |
products[].productId | false | number | string | Fallback identifier when variantId is unavailable. |
products[].attributes | false | Array<{ key: string; value: string }> | Optional line-item attributes passed through to checkout/cart create. |
variantId or productId.
Minimal Closet Payload Example
Resolution Rules
- Best: provide
variantIdfor each line item. - If
variantIdis missing, Hemsy falls back toproductId. attributesare preserved and passed to checkout line items.
URL-Safe Base64 Encoding
Hemsy expects URL-safe base64:- Replace
+with- - Replace
/with_ - Remove trailing
=
Always wrap
data-hemsy-closet values in quotes. URL-safe base64 strings can
contain = characters that will break unquoted HTML parsing.Programmatic API
If you’d rather open Hemsy from JavaScript, usewindow.HemsyEmbed:
End-to-End Example
Common Mistake
Do not usedata-hemsy-trigger:
data-hemsy-trigger is not a supported launcher configuration. Specify data-hemsy-selector on the script tag, then make the clickable element match that selector.
Use this instead for a flow: