# Authentication Source: https://docs.hemsy.ai/agents/authentication Create a developer account, buy prepaid credits, and authenticate with a Bearer API key. Every `visualize` call, MCP or REST, requires a developer API key with a positive credit balance. There is no unauthenticated or free tier: requests without a valid key return `401`, and requests with an empty balance return `402`. ## 1. Create an account Sign up at [developers.hemsy.ai](https://developers.hemsy.ai). If you already have a Hemsy merchant dashboard login, sign in with the same email. Your developer account and its credit balance are separate from any store's billing. ## 2. Buy credits Credits are prepaid. No subscription. Go to **Credits**, pick a pack, and check out with Stripe. 1 credit is consumed per successful render; failed renders are not charged. ## 3. Create an API key Go to **API keys** and create a key. The full key (`hemsy_…`) is shown **once**: only a hash is stored, so copy it immediately. You can revoke and re-issue keys at any time. ## 4. Send it as a Bearer token Pass the key in the `Authorization` header on every request: ```bash theme={null} Authorization: Bearer hemsy_4f3c9a... ``` This is the same header for the MCP endpoint and the REST endpoint. If an MCP connector UI only supports OAuth or no-auth (and can't send custom headers), use the keyed URL instead: `https://api.hemsy.ai/mcp/hemsy_...` with **no authentication**. See [MCP](/agents/mcp). ## Error responses | Status | Meaning | Fix | | - | - | - | | `401` | Missing, invalid, or revoked key | Create or check your key at [developers.hemsy.ai](https://developers.hemsy.ai) | | `402` | Insufficient credits | Buy a credit pack | | `429` | Rate limit exceeded | Slow down and retry | Error bodies include a `developers_url` pointer so agents can surface the top-up link to their users: ```json theme={null} { "error": "Insufficient credits", "message": "Buy credits at https://developers.hemsy.ai", "remaining_credits": 0, "developers_url": "https://developers.hemsy.ai" } ``` > [!WARNING] > > Treat API keys as secrets. Don't ship them in client-side code. Proxy > calls through your backend, or scope one key per agent deployment so you > can revoke it independently. # MCP Source: https://docs.hemsy.ai/agents/mcp Connect to the Hemsy visualize MCP server from Cursor, Claude, ChatGPT, or any MCP client. The Hemsy MCP server exposes a single tool, `visualize`, over stateless Streamable HTTP. ```text theme={null} Server URL: https://api.hemsy.ai/mcp Auth: Authorization: Bearer hemsy_... Keyed URL: https://api.hemsy.ai/mcp/hemsy_... Auth: none (key is in the path); for connector UIs that only offer OAuth or no-auth ``` ## Connect a client Most MCP clients take a server URL plus optional headers. Use your API key from [developers.hemsy.ai](https://developers.hemsy.ai) (see [Authentication](/agents/authentication)). > [tab] Cursor > > Add to `.cursor/mcp.json` (project) or `~/.cursor/mcp.json` (global): > > ```json theme={null} > { > "mcpServers": { > "hemsy-visualize": { > "url": "https://api.hemsy.ai/mcp", > "headers": { > "Authorization": "Bearer hemsy_..." > } > } > } > } > ``` > [tab] Claude > > Claude's remote connector UI only offers **OAuth** or **no authentication**. It cannot send a Bearer header. Use the keyed URL: > > ```text theme={null} > https://api.hemsy.ai/mcp/hemsy_... > ``` > > Register the connector with **no authentication**. The API key in the path is what authenticates the request. > [tab] ChatGPT > > ChatGPT's connector UI only offers **OAuth** or **no authentication**. It cannot send a Bearer header. Use the keyed URL: > > ```text theme={null} > https://api.hemsy.ai/mcp/hemsy_... > ``` > > Register the connector with **no authentication**. The API key in the path is what authenticates the request. > [tab] Other clients > > Any client that supports Streamable HTTP MCP works the same way: point it > at `https://api.hemsy.ai/mcp` and send the `Authorization: Bearer > hemsy_...` header on every request. The server is stateless: no session > setup required. > > If the client UI only supports OAuth or no-auth, use the keyed URL > (`https://api.hemsy.ai/mcp/hemsy_...`) with no authentication instead. ## The `visualize` tool ```ts theme={null} { sceneImage: string, // https URL or data URL (room, person, space) products: [{ title?: string, category?: string, // e.g. "bedding", "sofa", "tops" images?: string[], // product image URLs. Required unless productUrl resolves productUrl?: string, // PDP URL. Unlocks merchant fidelity when it matches a Hemsy store productId?: string, // Shopify product id (optional) variantId?: string, // Shopify variant id (optional, best asset match) color?: string, tags?: string[] }], aspect?: "auto" // output matches the scene image } ``` Response (structured content): ```json theme={null} { "ok": true, "image": "data:image/png;base64,...", "products": [ { "index": 0, "fidelity": "merchant", "storeSlug": "acme-home" } ], "usage": { "credits": 1, "balance": 249 } } ``` ## Usage notes * **Pass only what the user picked.** A search tool may suggest ten products; call `visualize` with the one or two the user actually wants to see. One product per call is the common case; multiple products are composed into the same scene. * **`productUrl` is the fidelity signal.** When the product page URL belongs to a Hemsy merchant, that item renders with the merchant's catalog reference assets. The response echoes `storeSlug` so you can reuse it in follow-up calls. * **Renders can take a few minutes.** Set your client's tool timeout to at least 300 seconds, same as the [REST API](/agents/rest-api#timeouts). * **1 credit per successful render.** Errors (`401` no key, `402` no credits, `429` rate limited) are returned before any render starts. # Overview Source: https://docs.hemsy.ai/agents/overview The Visualize API renders any product photorealistically into any scene photo, built for agents, paid per call with prepaid credits. The Visualize API does one job: **product images + a scene photo in, a photoreal localized edit out.** This is not generic image generation. Hemsy edits only the product slots in the user's real photo: room/person, camera, and lighting stay; product references (and merchant color/texture swatches when available) lock silhouette, material, and colorway. That is why it beats "ask the model to invent a bedroom with a navy duvet" for in-space decisions. It is built for AI agents and the tools that power them. A shopping agent recommends a duvet cover; your user wants to see it on their bed. One `visualize` call returns the render: no catalog integration, no merchant onboarding, no permission needed from anyone. ```text theme={null} Input: any product image(s) + any scene image Output: a photorealistic render Payment: prepaid credits, 1 credit per successful render ``` ## Two ways to call it | Surface | For | Endpoint | | - | - | - | | [MCP](/agents/mcp) | MCP-native agents (Cursor, Claude, ChatGPT, custom) | `https://api.hemsy.ai/mcp` | | [REST](/agents/rest-api) | Anything that can make an HTTP request | `POST https://api.hemsy.ai/visualize` | Both surfaces expose the same single tool with the same authentication: a developer API key from [developers.hemsy.ai](https://developers.hemsy.ai). ## Merchant fidelity upgrade If a product you pass belongs to a Hemsy merchant, the render automatically upgrades to that merchant's full catalog fidelity: variant reference imagery, color swatches, and placement rules the merchant configured for their own storefront visualization. You don't need to do anything to get this: pass the product's page URL (`productUrl`) and the upgrade happens automatically when the product resolves to a Hemsy store. The response tells you which products rendered at `merchant` fidelity vs `generic`. > [!NOTE] > > This is **not** the merchant embed/Visualize API. Merchants embedding visualizations on > their own storefront should use the [Merchant Visualize API](/api-reference/merchant-try-on) and Embeds. > The Visualize API is developer-pays: your credits, any product, any scene. ## Pricing 1 credit = 1 successful render, regardless of how many products are composed into the scene. Failed renders are not charged. Buy prepaid credit packs at [developers.hemsy.ai](https://developers.hemsy.ai). No subscription. ## Next steps > [card] [Authentication](/agents/authentication) > > Create an account, buy credits, and mint your API key. > [card] [Connect over MCP](/agents/mcp) > > Add the server URL to Cursor, Claude, or any MCP client. > [card] [REST API](/agents/rest-api) > > Call POST /visualize from anything that speaks HTTP. # REST API Source: https://docs.hemsy.ai/agents/rest-api POST /visualize: the same render as the MCP tool, callable from anything that speaks HTTP. If your agent or backend doesn't use MCP, call the plain HTTP endpoint. It shares the exact same handler, authentication, and billing as the MCP tool. ```text theme={null} POST https://api.hemsy.ai/visualize Authorization: Bearer hemsy_... Content-Type: application/json ``` ## Request ```bash theme={null} curl -X POST https://api.hemsy.ai/visualize \ -H "Authorization: Bearer hemsy_..." \ -H "Content-Type: application/json" \ -d '{ "sceneImage": "https://example.com/my-bedroom.jpg", "products": [{ "title": "Linen Duvet Cover", "category": "bedding", "productUrl": "https://brand.com/products/linen-duvet", "images": ["https://brand.com/cdn/duvet-front.jpg"] }] }' ``` | Field | Type | Notes | | - | - | - | | `sceneImage` | string (required) | https URL or data URL of the scene (room, person, space) | | `products[]` | array (required, 1–6) | Products to compose into the scene | | `products[].images` | string\[] | Product image URLs (https). Required unless `productUrl` resolves to a Hemsy merchant product | | `products[].productUrl` | string | Product page URL. Unlocks merchant fidelity when it matches a Hemsy store | | `products[].title`, `category`, `color`, `tags` | string(s) | Optional descriptors that improve render quality | | `products[].productId`, `variantId` | string | Optional Shopify ids; improve merchant asset matching | | `aspect` | `"auto"` | Output matches the scene image aspect | Prefer https image URLs over base64 data URLs. Inline images are capped at 8 MB each. ## Response ```json theme={null} { "image": "data:image/png;base64,...", "products": [ { "index": 0, "fidelity": "merchant", "storeSlug": "acme-home" } ], "usage": { "credits": 1, "balance": 249 } } ``` `products[].fidelity` is `merchant` when the item matched a Hemsy merchant and rendered with their catalog assets, otherwise `generic`. ## Errors | Status | Body `code` | Meaning | | - | - | - | | `400` | - | Invalid input (missing scene, no renderable products, too many images) | | `401` | - | Missing, invalid, or revoked API key | | `402` | `INSUFFICIENT_CREDITS` | Balance is empty. Top up at [developers.hemsy.ai](https://developers.hemsy.ai) | | `429` | - | Rate limit exceeded | | `502` / `503` | `MODEL_ERROR` / `MODEL_UNAVAILABLE` | Render providers failed. Retry; you were not charged | ## Timeouts Renders can take a few minutes; set your HTTP client timeout to at least 300 seconds. Credits are only consumed on success. See also the interactive [API playground](/api-reference/agent-try-on) for the schema, or [Authentication](/agents/authentication) for key setup. # Agent Visualize Source: https://docs.hemsy.ai/api-reference/agent-try-on api-reference/visualize-openapi.json POST /visualize Render any product(s) into any scene photo, billed to your developer account. Products from Hemsy merchants automatically upgrade to full catalog fidelity. # Merchant Visualize Source: https://docs.hemsy.ai/api-reference/merchant-try-on api-reference/openapi.json POST /api/try-on Generate a visualization for your own storefront's products, billed to your merchant account. ## Attribute orders A successful response includes an `attribution` array. Copy each `{ key, value }` onto the shopper's Shopify cart, either as cart attributes or as line-item properties on the items they visualized. Orders carrying these attributes count toward Hemsy revenue in the dashboard's Analytics page, and the `_hemsy_request_id` value links the order back to this visualization. ```json theme={null} { "image": "data:image/png;base64,...", "attribution": [{ "key": "_hemsy_request_id", "value": "iad1::abc123" }] } ``` Pass Shopify `variantId` or `productId` values in the request (rather than raw image URLs) so the visualization also appears in the store's Top Products. # Deep Links Source: https://docs.hemsy.ai/deep-links Open a shopper's Hemsy session on a product, a flow's starter look, or a shared look, with attribution data, via URL parameters. ## Overview **Deep links** are URLs that configure how Hemsy opens: a pre-loaded product, a flow's starter look, or a shared look, plus optional attribution IDs. Use them from product pages, emails, ads, blog posts, or collection tiles so customers don't have to build a look from scratch or lose tracking context. Hemsy supports these query parameters for pre-populating or attributing a session: | Param | Purpose | | - | - | | `?product=` | Shortcut for a **single product** by Shopify ID or handle. | | `?share=` | A **shared look** short ID, used by the in-app Share feature. | | `?flow=` | Opens a **flow** on its starter look, by flow ID (copy it from the dashboard's Flows page). With `?product=`, opens that product in its flow step. | | `?anonymous_id=` | Anonymous visitor ID passed into Hemsy for analytics, attribution, and integrations. | All of these can be combined with `?store=` on [staging](/staging) and preview deployments to target a specific tenant. > [!NOTE] > > Include `anonymous_id` whenever the storefront has an anonymous visitor ID > available. Today, Hemsy uses it for Twilio Segment tracking and checkout/order > attribution. Longer term, it should be treated as the shared anonymous > identity for all integrations that need to connect Hemsy activity back to > storefront activity. *** ## `anonymous_id`: Visitor attribution `anonymous_id` is an optional query parameter that lets the merchant storefront tell Hemsy which anonymous visitor is opening the experience. Use it when launching Hemsy from: * Embedded storefront buttons * Product page links * Email or ad links where the visitor ID is available * Any integration that wants to reconcile Hemsy events with storefront behavior Example: ```txt theme={null} https://yourstore.hemsy.ai/?anonymous_id=visitor-42 ``` Combined with a product shortcut: ```txt theme={null} https://yourstore.hemsy.ai/?product=organic-cotton-duvet&anonymous_id=visitor-42 ``` Combined with a shared look: ```txt theme={null} https://yourstore.hemsy.ai/?share=abc123&anonymous_id=visitor-42 ``` ### What `anonymous_id` does When present, Hemsy uses `anonymous_id` to: * Attach the visitor identity to Hemsy analytics events. * Pass the same identity through checkout creation, so it can surface on the Shopify order as an additional detail/custom attribute when the order is placed through Hemsy checkout. * Provide a stable identity key for supported integrations. > [!NOTE] > > Current integration support is focused on Twilio Segment. Merchants should > still pass `anonymous_id` consistently now so Hemsy can use the same identity > for additional integrations as they are added. > [!WARNING] > > If a shopper visits a Hemsy-hosted URL directly, for example by typing > `https://yourstore.hemsy.ai/` into the browser, Hemsy cannot infer the > anonymous visitor ID from the merchant's storefront domain. The storefront > must pass the ID explicitly via `anonymous_id` in the URL or via the embed > script configuration. *** ## `?product=`: Single-product shortcut For the common case of "launch Hemsy with one product pre-loaded", `?product=` accepts either: * A numeric Shopify **product ID**: `?product=8888888888888` * A Shopify **GID**: `?product=gid://shopify/Product/8888888888888` * A product **handle**: `?product=organic-cotton-duvet` ```txt theme={null} https://yourstore.hemsy.ai/?product=organic-cotton-duvet ``` With visitor attribution: ```txt theme={null} https://yourstore.hemsy.ai/?product=organic-cotton-duvet&anonymous_id=visitor-42 ``` The product is added as the first layer and rendered on your first model photo right away. *** ## `?share=`: Shared-look links `?share=` is reserved for links generated by Hemsy's in-app Share feature. The short ID resolves server-side to a previously saved look: user photo, generated image, and full selection. You don't need to construct these yourself. They're produced by the app when a shopper taps **Share**. If the storefront knows the visitor identity, append `anonymous_id` to shared look links too: ```txt theme={null} https://yourstore.hemsy.ai/?share=abc123&anonymous_id=visitor-42 ``` *** ## `?flow=`: Flow links `?flow=` opens a flow on its starter look: one layer per flow step, already filled in with the merchant's starter picks, and the saved starter render. See [Launch Modes](/embeds/launch-modes#flow) for how flows are set up. ```txt theme={null} https://yourstore.hemsy.ai/?flow=YOUR_FLOW_ID&anonymous_id=visitor-42 ``` Combined with `?product=`, the flow opens with that product in its matching step, the other steps empty, and the product rendered right away. See [Product context in a flow](/embeds/launch-modes#product-context-in-a-flow). ```txt theme={null} https://yourstore.hemsy.ai/?product=organic-cotton-sheet-set&flow=YOUR_FLOW_ID ``` `?flow=` is ignored when the link also carries `?share=`. # Checkout vs Cart Resolution Source: https://docs.hemsy.ai/embeds/checkout-vs-cart Choose what the final CTA does: open Shopify checkout, or hand variant data back to your storefront's own cart. The layer screen has one final CTA under the look, labeled with the look's total. `data-hemsy-action` on the script tag sets the default, and any launcher element can override it with its own `data-hemsy-action`. It applies to every launch mode. | Action | CTA label | What happens | | - | - | - | | `checkout` (default) | "Checkout" | Hemsy creates or opens a Shopify checkout/cart URL directly. | | `cart` | "Go to Cart" | Hemsy posts the selected variants back to your page, calls `window.HemsyEmbedConfig.onProductVariantData(payload)`, and closes the modal. | In the [Shopify theme extension](/embeds/shopify), this is the app embed's "When shoppers finish" setting and each trigger block's override, with no attributes to write. The examples below show the equivalent [script install](/embeds/script) markup. Use `cart` when shoppers should land in your store's cart instead of checkout, for example a theme with a custom cart drawer. ```html theme={null} ``` To override the action for a single launcher, put `data-hemsy-action` on the element: ```html theme={null} ``` > [!NOTE] > > The legacy script-level `data-hemsy-mode="cart"` still maps to the cart > action for backward compatibility, but prefer `data-hemsy-action`. > (`data-hemsy-mode="checkout"` has no effect; checkout is simply the default > action.) ## Native cart strategy By default the `cart` action hands items to *your* code via `onProductVariantData`, which means writing a callback. If your storefront is a standard Shopify theme, skip that entirely with `data-hemsy-cart-strategy="native"`: ```html theme={null} ``` With the native strategy, when the shopper clicks the final CTA Hemsy: 1. Adds the returned items to the Shopify cart via the Ajax API (`/cart/add.js`), converting variant GIDs to numeric IDs and mapping item attributes to line-item properties. 2. Dispatches `cart:refresh`, `cart:updated`, and `cart:change` events on `document` with the updated cart, so cart drawers and count bubbles that listen for them update in place. 3. Closes the modal once the add completes (unless `data-hemsy-auto-close="false"`). Callbacks still fire if you define them, so you can layer analytics on top. A cart failure never traps the shopper: the modal closes regardless and the error is logged to the console. > [!NOTE] > > The [Shopify theme extension](/embeds/shopify) uses the native strategy > automatically, so merchants who install through the theme editor get a working > cart handoff with zero code. ## Event callbacks Callbacks are configured on `window.HemsyEmbedConfig` (not data attributes). Define it before the embed script loads: ```html theme={null} ``` | Callback | Payload | Fires when | | - | - | - | | `onItemAdded` | `{ variantId: string, quantity: number }` | An item is added to the look inside Hemsy | | `onItemRemoved` | `{ variantId: string }` | An item is removed from the look inside Hemsy | | `onProductVariantData` | `{ items: Array<{ variantId: string, quantity: number, attributes?: Array<{ key: string, value: string }> }> }` | `action: "cart"` and the final CTA is clicked | `onItemAdded` and `onItemRemoved` fire live as the shopper edits their look (adding, removing, or swapping a layer), regardless of action. `onProductVariantData` is the cart handoff itself: the `items` array includes any line-item attributes on the items, so pass them through to your cart. ### Keeping the modal open By default, Hemsy closes the modal after the cart handoff. Set `data-hemsy-auto-close="false"` on the script tag (or `autoClose: false` on `HemsyEmbedConfig`) to keep it open (for example if you show your cart drawer next to the modal). # Incrementality Source: https://docs.hemsy.ai/embeds/incrementality Run a storefront holdout so you can measure the revenue Hemsy actually adds, and only after the embed is opted in. Incrementality mode is an A/B holdout. 90% of shoppers see your Hemsy calls to action as usual. A random 10% never see them. Comparing the two groups is how the dashboard estimates lift and net new revenue. You configure the test in the Hemsy dashboard (**Incrementality**). The storefront does **not** start that test from the dashboard toggle alone. ## The embed must opt in `hemsy-embed.js` calls `/api/incrementality/init` only when the script is explicitly opted in. Without that flag, the holdout never starts: no bucketing, no hiding, no cart tags. Existing installs (including a typical Shopify homepage script) do **not** include this attribute. That is intentional. A store with incrementality off in the dashboard should not hit Hemsy on every new session. Add **one** of these on the same page as the embed: ```html theme={null} ``` Or: ```html theme={null} ``` Accepted values: `true`, `"true"`, or `"1"`. Anything else (or omitting the flag) leaves incrementality off. > [!NOTE] > > The [Shopify theme app embed](/embeds/shopify) has no incrementality setting. > If you installed from the theme editor, add the `HemsyEmbedConfig` snippet > above to your theme code (for example in `theme.liquid`), and the app embed's > script picks it up. Turning the dashboard toggle **on** without the script flag does nothing on the storefront. Turning the toggle **off** still matters: even an opted-in embed gets `{ enabled: false }` from init and will not hide CTAs or tag carts. ## What happens when it is on Both of these must be true: 1. The embed is opted in (`data-hemsy-incrementality` or `HemsyEmbedConfig.incrementality`). 2. **Incrementality Mode** is enabled on the store in the dashboard. Then, once per tab session: 1. The embed POSTs `/api/incrementality/init` with the store slug and a visitor id. 2. Hemsy assigns the visitor to **treatment** (90%) or **control** (10%). The assignment is stable for that visitor. 3. Control visitors get a CSS hide on the selectors you saved in the dashboard (your Hemsy buttons, nav links, and any other CTAs). 4. The Shopify Ajax cart is tagged with `hemsy_group` and `hemsy_visitor_id` so later orders can be bucketed. The result is cached in `sessionStorage` for the rest of that tab. Later pages in the same tab do not call init again. The hide styles are re-applied from that cache on each page load. > [!NOTE] > > Add at least one CSS selector before enabling the dashboard toggle. One > selector per line: IDs or class names of every Hemsy CTA on the storefront. > If the holdout group has nothing to hide, both groups see Hemsy and the test > measures nothing. ## Dashboard On **Incrementality** you can: * Enable or disable Incrementality Mode * Edit the holdout CSS selectors * Compare baseline vs Hemsy conversion, lift, and net new revenue over a date range Shopify must be connected. Metrics stay available when the mode is off; they reflect any earlier test data in the selected period. Dollar estimates stay hidden until there is enough data: at least 100 sessions in each group and at least 5 orders in the holdout group. The holdout split is fixed at 10% control. It is not merchant-configurable. Changing it mid-test would reassign visitors and contaminate the results. # JavaScript API Source: https://docs.hemsy.ai/embeds/javascript-api Open and close Hemsy programmatically with window.HemsyEmbed, and configure the embed with window.HemsyEmbedConfig. If you'd rather open Hemsy from JavaScript than from launcher attributes (for dynamic elements, custom routing, or your own event handling), use `window.HemsyEmbed`. The embed script must be loaded on the page. Either install path works, since the [theme extension](/embeds/shopify) and the [script install](/embeds/script) load the same script. ## Opening ```js theme={null} // Sandbox (blank interactive experience) HemsyEmbed.open("scratch"); // Product context, auto-built from the current page HemsyEmbed.open({ payload: { autoProductContext: true } }); // Shared look by short ID HemsyEmbed.open("share", { share: "FreyjHz4" }); // Flow, opened on its starter look (same as a flow-only launcher) HemsyEmbed.open({ payload: { flow: "YOUR_FLOW_ID" } }); // Current product, placed in its step of a flow (see Product context in a flow) HemsyEmbed.open({ payload: { autoProductContext: true, flow: "YOUR_FLOW_ID" } }); // Override the final action for this open only (checkout is the default) HemsyEmbed.open("scratch", { action: "cart" }); ``` Each call resolves its own mode and action the same way a launcher does (see [Launch Modes](/embeds/launch-modes#resolution-order)). Passing `action` in the payload overrides the page-level `data-hemsy-action` for that open only. ## Closing ```js theme={null} HemsyEmbed.close(); ``` ## Configuration with `HemsyEmbedConfig` `window.HemsyEmbedConfig` is the JavaScript alternative to script-tag data attributes, and the only place to register [event callbacks](/embeds/checkout-vs-cart#event-callbacks). Define it before the embed script loads: ```js theme={null} window.HemsyEmbedConfig = { subdomain: "your-store-subdomain", selector: ".hemsy-launcher", action: "cart", // optional; default action, same as data-hemsy-action cartStrategy: "native", // optional; same as data-hemsy-cart-strategy anonymousId: "visitor-42", // optional; same as data-hemsy-anonymous-id autoClose: false, // optional; same as data-hemsy-auto-close incrementality: true, // optional; same as data-hemsy-incrementality onItemAdded: (item) => {}, onItemRemoved: (item) => {}, onProductVariantData: (payload) => {}, }; ``` > [!NOTE] > > When the same setting appears both on `HemsyEmbedConfig` and as a script-tag > data attribute, the **script attribute wins**. Keep each setting in one place > to avoid surprises. # Launch Modes Source: https://docs.hemsy.ai/embeds/launch-modes Control what each click opens: Sandbox, Product context, Share, or Flow. Every launcher element decides its own launch mode from the attributes on that exact clicked element. The attributes are the same whether the [Shopify trigger block](/embeds/shopify) emits them from theme editor settings or you write them by hand with the [script install](/embeds/script). This page covers each mode and the order they're resolved in. Every mode opens the same screen: the visualization on top (or on the left on desktop), a toolbar under it for share and download, and the look as a list of **layers** below it. Shoppers change a layer's color or size, swap its product, add or remove layers, then tap **Update preview** to re-render. Only the starting state differs by mode. ## Resolution order When a launcher is clicked, Hemsy picks the launch mode by checking, in order: 1. **Share**: the element has `data-hemsy-share`. 2. **Product context**: the element has `data-hemsy-auto-product-context="true"` and a variant is detected on the page. 3. **Sandbox**: none of the above. `data-hemsy-flow` turns a Sandbox launch into a Flow launch: the look opens on the flow's starter look. On a Product context launch it opens the product [inside the flow](#product-context-in-a-flow) instead. Share launches already have a look, so they ignore it. `data-hemsy-action` (checkout vs cart) is independent of launch mode. It only changes what the final CTA does. See [Checkout vs Cart](/embeds/checkout-vs-cart). ## Launcher attributes | Attribute | Example | Description | | - | - | - | | `data-hemsy-share` | `"FreyjHz4"` | Opens a previously shared look by its short ID. | | `data-hemsy-auto-product-context` | `"true"` | Opens with the current PDP variant and renders it right away. Falls back to Sandbox if no variant is detected. | | `data-hemsy-flow` | `""` | Opens the flow's starter look, or with Product context, the product in its flow step. Ignored for Share. Must be on the clicked element. | | `data-hemsy-action` | `"cart"` | Overrides the final CTA (`checkout` or `cart`) for this launcher only. See [Checkout vs Cart](/embeds/checkout-vs-cart). | ## Sandbox The default. No launcher attributes needed. The shopper starts on your first model photo with an empty look, then adds items from your full catalog. ```html theme={null} Design a look ``` ## Product context (PDP) Launch with the product the shopper is currently viewing. Hemsy reads the selected variant from the page (the add-to-cart form or a `?variant=` URL parameter), adds it as the first layer, and renders it on your first model photo without asking for a photo first. ```html theme={null} ``` If no variant can be detected, the launcher falls back to Sandbox mode. ### Product context in a flow Add `data-hemsy-flow` to a Product context launcher to open the product inside a flow, so shoppers see the rest of the look they could build around it: ```html theme={null} ``` * The product goes into the flow step whose scope (collection, tag, category, or metafield) covers it. A sheet set lands in the sheet set step, a throw in the throw step. If it fits several steps, the first one wins. * The flow's other steps open empty, ready to fill. The flow's starter picks and starter image are skipped. * The product renders right away on the flow's reference image, the same single render as a plain Product context launch. * A product no step covers still renders, as an extra layer below the flow's steps. The same works from the [JavaScript API](/embeds/javascript-api) and [deep links](/deep-links). ## Share Open a previously shared look by its short ID: the shopper's photo, the render, and every item. Useful for marketing campaigns, emails, or featuring shopper-created looks on your storefront. ```html theme={null} ``` Share IDs are generated by Hemsy's in-app Share feature; you don't construct them yourself. ## Flow Open a flow on its **starter look**: a finished render with one layer per flow step, already filled in. ```html theme={null} ``` Copy flow IDs from the dashboard's **Flows** page. Each flow sets up: * **Layers**: one per step, each scoped to a set of products. The shopper swaps a layer's product from that scope. Required layers can be swapped but not removed. * **Starter picks**: the product and variant each layer opens on. * **Reference image**: the photo the look renders on. * **Starter image**: a saved render of the starter picks on the reference image, generated from the flow editor. The shopper sees it the moment the flow opens, with no wait. * **Shared sizes** (optional): one size picker that sets the size on several layers at once, such as a bed size shared by the sheets, duvet, and coverlet. Hemsy matches each layer's own size names ("Cal. King", "King/Cal. King", and so on) to the shared value. If a flow has no starter image yet, the shopper sees the reference image with the starter picks listed and taps **Update preview** to render. ## URL auto-open The embed script watches the page URL for `?share=` and opens the modal automatically on page load: ``` https://your-store.com/?share=FreyjHz4 ``` This powers share links: recipients see the look immediately. The parameter is removed from the URL after opening so a refresh doesn't re-trigger it. For SPAs, the script also intercepts `history.pushState` to catch client-side navigations. For links to the hosted experience, see [Deep Links](/deep-links). # Overview Source: https://docs.hemsy.ai/embeds/overview Add the Hemsy embed to your storefront: pick an install path, then configure launchers and what happens at checkout. Hemsy Embeds let shoppers open the full Hemsy visualization experience in a modal on your own storefront. Any element on the page can become a launcher. However it's installed, an embed comes down to three knobs: | Knob | Where it's set | What it controls | | - | - | - | | **Embed setup** | Once per storefront (theme editor or script tag) | Your store subdomain, which elements are launchers, and page-wide defaults | | **Launch mode** | Per launcher | What that click opens: Sandbox, product context, Share, or Flow | | **Final action** | Page-wide default, overridable per launcher | What the final CTA does: Shopify checkout (default) or handing items to your cart | Everything else in these docs is payload detail or recipes for those three knobs. ## Choose your install There are two ways to put Hemsy on a storefront. Both load the same embed script and use the same launcher attributes. The only difference is who writes the markup. > [card] [Shopify theme extension](/embeds/shopify) > > For Online Store themes. Enable the app embed and add trigger blocks from > the theme editor. No code, and Hemsy handles the cart for you. > [card] [Script tag](/embeds/script) > > For editing your theme code directly, or any page where you own the > markup. One script tag plus launcher attributes. | How you want to install | Install path | | - | - | | From the Shopify theme editor, no code | [Theme extension](/embeds/shopify) | | By editing your Shopify theme code | [Script tag](/embeds/script) | | On any other page you control (e.g., You own web app) | [Script tag](/embeds/script) | ## Configure it These pages apply to both install paths. The theme extension's settings map one-to-one onto the same launcher attributes you'd write by hand. > [card] [Launch modes](/embeds/launch-modes) > > Sandbox, product context, Share, and Flow, plus which one wins when a > launcher has multiple attributes. > [card] [Checkout vs Cart](/embeds/checkout-vs-cart) > > Decide what the final CTA does, and sync Hemsy with your own cart state. > [card] [JavaScript API](/embeds/javascript-api) > > Open and close Hemsy programmatically with `window.HemsyEmbed`. > [card] [Deep Links](/deep-links) > > Link straight to a product, a flow, or a shared look on the hosted > experience, with attribution. # Script Install Source: https://docs.hemsy.ai/embeds/script Install the Hemsy embed by adding one script tag to your theme code, or to any page where you own the markup. One script tag turns any element on your page into a Hemsy launcher. Add it to your Shopify theme code (for example `theme.liquid`) if you'd rather edit the theme yourself, or to any other page where you own the markup. > [!NOTE] > > Prefer not to touch code? The [theme app extension](/embeds/shopify) places > this same script for you from the theme editor. ## Install ```html theme={null} Design a look ``` Any element matching `data-hemsy-selector` becomes a launcher. With no extra attributes, clicking it opens **Sandbox mode**: the full interactive experience, starting blank. What each launcher opens, and what its final CTA does, is controlled by [launcher attributes](/embeds/launch-modes). Use a shared class selector like `.hemsy-launcher` when multiple elements should open Hemsy. Avoid reusing the same `id` on multiple elements. > [!NOTE] > > Launchers are bound when the script loads. Elements added to the page later > (for example by client-side rendering after load) will not automatically > become launchers. Use the [JavaScript API](/embeds/javascript-api) for > dynamic elements. One exception: the script re-scans for launchers on > Shopify's `shopify:section:load` event, so theme editor re-renders keep > working. ## Script attributes | Attribute | Required | Example | Description | | - | - | - | - | | `data-hemsy-subdomain` | Yes | `"mystore"` | Your Hemsy store subdomain. For `mystore.hemsy.ai`, use `"mystore"`. | | `data-hemsy-selector` | Yes | `".hemsy-launcher"` | CSS selector for elements that launch Hemsy. | | `data-hemsy-action` | No | `"cart"` | Default final CTA behavior: `"checkout"` (default) opens Shopify checkout; `"cart"` hands items to your cart. Individual launchers can override it. See [Checkout vs Cart](/embeds/checkout-vs-cart). | | `data-hemsy-cart-strategy` | No | `"native"` | With the `cart` action, `"native"` makes Hemsy add returned items straight into the Shopify cart itself. Uses Shopify's Ajax cart API, which every Online Store theme has. See [Native cart strategy](/embeds/checkout-vs-cart#native-cart-strategy). | | `data-hemsy-anonymous-id` | No | `"visitor-42"` | Anonymous visitor ID passed through to Hemsy for analytics and order metadata. See [Segment](/segment). | | `data-hemsy-auto-close` | No | `"false"` | Keep the modal open after the cart handoff instead of closing it. | | `data-hemsy-incrementality` | No | `"true"` | Opt this page into incrementality init. Required for the storefront holdout. See [Incrementality](/embeds/incrementality). | Event callbacks (`onItemAdded`, `onItemRemoved`, `onProductVariantData`) are configured on `window.HemsyEmbedConfig`, not as data attributes. See [Checkout vs Cart](/embeds/checkout-vs-cart#event-callbacks). Without the native cart strategy, `onProductVariantData` is how returned items reach your cart. ## Rules worth knowing up front * Launch mode and the final action are **per launcher**: set `data-hemsy-share`, `data-hemsy-flow`, `data-hemsy-auto-product-context`, or `data-hemsy-action` on a launcher element to affect just that button. `data-hemsy-action` on the script tag acts as the page-wide default. * Prefer `data-hemsy-action` for checkout vs cart. The legacy script-level `data-hemsy-mode="cart"` still works for backward compatibility. * `data-hemsy-trigger` has no launcher semantics of its own. It's the conventional selector hook (`data-hemsy-selector="[data-hemsy-trigger]"`), which is what the [Shopify theme extension](/embeds/shopify) uses by default. # Shopify Theme Extension Source: https://docs.hemsy.ai/embeds/shopify Install Hemsy on a Shopify storefront from the theme editor: an app embed for the script and a trigger block for launch buttons. No code. The Hemsy Shopify app includes a theme app extension, so the script tag, launcher attributes, and checkout vs cart are configured from the Shopify theme editor instead of your theme code. Page-wide options without a theme editor setting, such as [incrementality](/embeds/incrementality), take one line of theme code. Your theme files are never edited, and uninstalling the app removes everything. The extension has two parts: | Part | What it is | Where it lives | | - | - | - | | **Hemsy Embed** (app embed) | Loads the embed script with your store slug and the page-wide checkout/cart default | Theme editor › **App embeds**, once per theme | | **Hemsy Trigger** (app block) | A styleable button or link that opens Hemsy, one per placement | Any section, typically product pages | > [!NOTE] > > Your Hemsy dashboard's **Embed** page has one-click deep links that open the > theme editor with each part pre-selected, plus your store slug ready to copy. ## 1. Enable the app embed 1. In the Shopify admin, go to **Online Store › Themes › Customize**, then open **App embeds** (the puzzle-piece icon). 2. Toggle on **Hemsy Embed**. 3. Paste your **Hemsy store slug** (copy it from the dashboard's Embed page). 4. Choose what happens **when shoppers finish**: * **Open Hemsy checkout** (default): Hemsy opens Shopify checkout directly. * **Add items to the store cart**: Hemsy adds the shopper's items straight into your store's cart using the [native cart strategy](/embeds/checkout-vs-cart#native-cart-strategy). No callback code is involved. 5. Save. The embed alone doesn't render anything. It binds any element matching `[data-hemsy-trigger]` as a launcher, which is exactly what the trigger block emits. ## 2. Add trigger blocks Add the **Hemsy Trigger** block to any section from the theme editor (product templates are the usual spot). Each block is its own launcher with its own settings: | Setting | What it does | | - | - | | **Opens** | The [launch mode](/embeds/launch-modes) for this button: Designer (blank canvas), this product page's item, a shared look, or a flow (opens on its starter look). | | **Share ID / Flow ID** | For shared-look and flow triggers. A Flow ID on a "this product page's item" trigger opens the product [inside that flow](/embeds/launch-modes#product-context-in-a-flow). Copy the IDs from the Hemsy dashboard. | | **When shoppers finish** | Inherit the app embed's checkout/cart setting, or override it for this button. | | **Display style, label, colors, sizing** | Button or link, full width, background/text/border colors, radius, padding, font size. | Because the launch mode and the finish action are per-launcher, you can freely mix triggers on one page: a "Try with this product" button next to a "Build a bed" flow button next to a plain designer link. ## Custom placements If you want to launch Hemsy from an element the trigger block can't reach (a nav link, a custom section), give that element the `data-hemsy-trigger` attribute plus any [launcher attributes](/embeds/launch-modes#launcher-attributes): ```html theme={null} Build a bed ``` The app embed's script binds it automatically, including elements re-rendered by the theme editor, which the script rebinds on `shopify:section:load`. ## Prefer editing code? Everything the extension does can also be done in your theme code: add the [script install](/embeds/script) to `theme.liquid` and put launcher attributes on your own elements. Same script, same attributes. Everything else in these docs applies equally to both install paths. # Endear Source: https://docs.hemsy.ai/endear Let stylists turn a Hemsy visualization look into an Endear story without leaving the visualization experience. Hemsy can push a finished visualization look into [Endear](https://endearhq.com) as a **story**. The story uses the generated visualization as its cover photo and attaches every product in the look, so your team can send it to a client from Endear like any other story. This is a **stylist-facing** integration. Shoppers never see it, and it does not forward analytics events. For that, see [Segment](/segment). ## Where it appears The **Send to Endear** button appears in the toolbar under the visualization in **stylist surfaces** only: | Surface | How it's opened | | - | - | | **Stylist tab** in the Hemsy dashboard | Available to owners, admins, and members with the stylist role. | | **Stylist embed** in another tool | Hemsy loaded with the `stylist=1` parameter, for example inside Endear or a support desk: `https://hemsy.ai/embed/{subdomain}?embed=1&stylist=1` | The button is hidden in the shopper-facing [embedded and hosted experiences](/embeds/overview), and it only renders once an Endear API key is saved for that store. ## Before you start * An Endear account with API access. * Your Shopify catalog **synced into Endear**. Hemsy attaches products by their Shopify variant ID, so a look can only be sent if those variants already exist in Endear. * A Hemsy plan that includes **Integrations**. ## Setup 1. In the Hemsy dashboard, open **Integrations**. 2. On the **Endear** card, paste your **Endear API Key**. You'll find it in your Endear dashboard under **Settings › API**. 3. Save. The card shows **Connected**, and **Send to Endear** appears for stylists on that store. Your key is stored encrypted and is never exposed to the browser. Use **Replace API key** to rotate it, or **Disconnect** to remove it. Disconnecting immediately hides the button for stylists. > [!NOTE] > > Endear only needs an API key. Unlike Segment, there is no endpoint URL to > configure. ## Creating a story 1. Build the look and run the visualization as usual. 2. In the toolbar under the visualization, click **Send to Endear**. 3. Enter a **Title** (required) and an optional **Description**. 4. Click **Create Story**. Hemsy confirms with **Story created in Endear!** and the story is ready in Endear. ## What Hemsy sends Each story is built from the look on screen: | Story item | Contents | | - | - | | **Cover photo** | The generated visualization, uploaded to Hemsy storage and passed to Endear as a public image URL. No product is attached to this item. | | **One item per product** | The Endear product variant for the selected Shopify variant, plus that variant's catalog image (falling back to the look image when the variant has none). | Hemsy resolves the Endear variant reference from your synced catalog, so Shopify variant `41931355815995` becomes `shop://{shop-integration-id}/ProductVariant/41931355815995`. ## Troubleshooting | Message | What to do | | - | - | | **One or more products were not found in Endear. Make sure your catalog is synced.** | The look contains variants Endear doesn't know about. Re-sync the Shopify catalog in Endear, then try again. | | **No synced products found in Endear. Sync your catalog before creating stories.** | Endear has no Shopify products at all, so Hemsy can't resolve variant references. Connect and sync the catalog in Endear first. | | **Endear created the story but no products were added.** | The story was created but every product failed to attach. Confirm the catalog is synced and that the variants in the look exist in Endear. | | **Not allowed to create stories with this API key.** | The key lacks story permissions or belongs to a different account. Generate a new key in Endear and replace it in **Integrations**. | | **Endear integration not configured** | No API key is saved for this store. Add one in **Integrations**. | If **Send to Endear** never appears, check that the card shows **Connected** and that you're in a stylist surface. The button is intentionally hidden in shopper-facing embeds. ## Related docs * [Segment](/segment): forward shopper visualization events to your analytics pipeline * [Hemsy Embeds](/embeds/overview): how the visualization experience is embedded # Roles & Permissions Source: https://docs.hemsy.ai/permissions Owner, admin, viewer, and stylist access in the Hemsy merchant dashboard. Hemsy organizations have **members**. Each member is assigned a **role** that controls what they can view and change. Roles can apply to **all stores** in the org or only **selected stores**. ## Roles ### Owner Owners have full control over the organization, including billing and destructive actions. * Manage billing * Create, configure, and delete stores * Invite and remove team members, including other owners * Change member roles and store access scopes * Full read/write access to every assigned store ### Admin Admins can run day-to-day operations but cannot manage billing or delete the organization or its stores. * View and edit store configuration, flows, integrations, and catalog settings * Invite and remove team members (except owners) * Cannot manage billing * Cannot delete stores or the organization * Cannot promote members to owner or demote owners ### Viewer Viewers have read-only access to assigned stores. * View dashboards, analytics, and store settings * Cannot change configuration, invite users, or manage billing * Cannot use the Stylist tab ### Stylist Stylists are store associates who create looks with customers. Their dashboard shows only the **Stylist** tab and read-only **Settings**. * Use the Stylist tab to visualize looks and send them to customers (for example via [Endear](/endear)) * Cannot change configuration, invite users, or manage billing ## Permission matrix Permissions apply within each member's **store access scope** (see below). | Capability | Owner | Admin | Viewer | Stylist | | - | - | - | - | - | | View dashboards and analytics | Yes | Yes | Yes | No² | | View store settings | Yes | Yes | Yes | Yes | | Use the Stylist tab | Yes | Yes | No | Yes | | Edit store configuration | Yes | Yes | No | No | | Manage flows | Yes | Yes | No | No | | Manage integrations | Yes | Yes | No | No | | Invite and remove members | Yes | Yes¹ | No | No | | Change member roles | Yes | No | No | No | | Manage billing | Yes | No | No | No | | Delete stores or organization | Yes | No | No | No | ¹ Admins can invite and remove non-owner members. Only owners can invite other owners or change owner roles. ² Hidden from the stylist's navigation. Stylists keep read access to the store, so treat them like viewers when deciding who gets the role. ## Store access scopes When you invite a member or edit their access, choose how broadly their role applies: * **All stores**: the role applies to every store in the organization. * **Selected stores**: the role applies only to the stores you assign. The member cannot see or access other stores. If a member has no access to a store, that store is hidden from their dashboard entirely. ## What happens when access is denied Hemsy does not show disabled actions as grayed-out controls in every case. When a member lacks permission: * **No store access**: the store does not appear in navigation. Direct links to that store return a **404 / page not found** response. * **View-only user attempts a change**: the action is blocked with: *"You have view-only access..."* * **Admin attempts billing or delete**: the action is blocked with: *"Only organization owners can..."* * **Viewer opens the Stylist tab**: the page returns **404 / page not found**. ## Team management Manage members from **Organization settings** in the Hemsy dashboard. * **Owners** can invite members, assign roles, set store access scopes, and remove any member (as long as at least one owner remains). * **Admins** can invite and remove admins, viewers, and stylists on stores they can access. They cannot manage owners or billing. * **Viewers** and **stylists** cannot invite or manage team members. > [!NOTE] > > Every organization must have at least one owner at all times. You cannot > remove the last owner from an organization. ## FAQ > [accordion] Can an organization have multiple owners? > > Yes. You can assign the owner role to multiple members. At least one owner > must remain on the organization at all times. > [accordion] Can admins manage billing? > > No. Only organization owners can manage billing. > [accordion] Can a viewer see analytics for stores they are assigned to? > > Yes. Viewers can view dashboards and analytics for their assigned stores. They > cannot change settings or invite team members. > [accordion] Which role should store associates get? > > **Stylist**, scoped to the stores they work in. They get the Stylist tab > without analytics in their navigation, and they can't change anything. > [accordion] What if I need someone to manage integrations but not billing? > > Assign the **admin** role with access to the relevant stores. Admins can > manage integrations and store configuration without billing access. # Segment Source: https://docs.hemsy.ai/segment Forward Hemsy visualization events from the embedded or hosted experience to your Segment workspace. Hemsy can forward **browser-side visualization events** to [Segment](https://segment.com) as `track` calls. Use this when you want visualization behavior in the same pipelines as your storefront (GA4, Mixpanel, Klaviyo, Snowflake, and so on). This is separate from the **Analytics** page in the dashboard, which shows aggregated KPIs (sessions, conversion, revenue, and so on). Segment receives individual events with properties; Analytics computes rollups from Hemsy's internal event store. ## Where Segment forwarding applies Segment forwarding works in **both** ways shoppers use Hemsy: | Experience | URL pattern | How shoppers arrive | | - | - | - | | **Embedded experience** | `https://hemsy.ai/embed/{subdomain}?embed=1&…` | Your storefront loads `hemsy-embed.js` and opens Hemsy in a modal iframe. | | **Hosted experience** | `https://{subdomain}.hemsy.ai?…` | Shoppers open your store's Hemsy subdomain directly (link, QR code, email, and so on). | Both surfaces run the same visualization app and send events through the same browser API (`POST /api/events`). Segment is **not** limited to embeds. Segment forwarding does **not** apply to: * The **Hemsy dashboard** (merchant admin UI). The one exception is the **Stylist** tab, which runs the stylist embed; its events are forwarded with `source: stylist`. * **Server-only** events (for example attributed orders written by Shopify order webhooks). Those feed Analytics, not the Segment forwarder. ## Setup 1. In the Hemsy dashboard, open **Integrations**. 2. Under **Segment**, enter your **Segment Endpoint URL** (for most workspaces: `https://api.segment.io`). 3. Optionally enter your **Write Key** (required for standard Segment endpoints; leave blank only if your proxy authenticates requests another way). 4. Save. The card shows **Connected** when an endpoint is configured. Hemsy sends `POST` requests to `{endpoint}/v1/track` with JSON bodies in Segment's HTTP API shape. ## Identity stitching (`anonymousId`) To align Hemsy Segment events with your storefront identity graph, pass the same stable ID you use elsewhere (for example Segment's `anonymousId`). Hemsy sends this value as Segment's `anonymousId` on every forwarded `track`. If you do not pass one, Hemsy uses its own browser visitor ID (`hemsy_visitor_id` in `localStorage`), which will **not** match your site unless you bridge IDs yourself. There is no automatic cross-domain handoff from your storefront to `{subdomain}.hemsy.ai`. You must pass the ID explicitly using one of the methods below. ### Embedded experience Set `data-hemsy-anonymous-id` on the embed script. The embed loader appends it to the iframe URL as `anonymous_id`: ```html theme={null} ``` You can also set `anonymousId` on `window.HemsyEmbedConfig` (see the [Embeds JavaScript API](/embeds/javascript-api)). ### Hosted experience Add the **`anonymous_id`** query parameter to any link to your Hemsy subdomain: ``` https://mystore.hemsy.ai?anonymous_id=visitor-42 ``` Works alongside other parameters: ``` https://mystore.hemsy.ai?anonymous_id=visitor-42&flow= https://mystore.hemsy.ai?anonymous_id=visitor-42&product= ``` Use the same ID you use on your storefront and in Segment. When a shopper lands without `anonymous_id`, only Hemsy's generated visitor ID is used. ### Checkout metadata The same `anonymous_id` is attached to the Shopify cart as a cart attribute (`anonymous_id`) when the shopper checks out from either experience, so it shows under the order's **Additional details**. ## How forwarding works 1. The shopper uses the **embedded** or **hosted** visualization experience. 2. The browser records the event in Hemsy and POSTs to `/api/events`. 3. If Segment is configured, Hemsy forwards a **`track`** call with a human-readable name prefixed with `Hemsy `. Forwarding runs only when: * The event has a Segment mapping (see [Forwarded events](#forwarded-events)). * Your store has a valid Segment endpoint saved in Integrations. * The request passes Hemsy's store context checks (host / origin / referer match your store slug or an allowed Hemsy host such as `hemsy.ai`, `{subdomain}.hemsy.ai`, staging, or local dev). ## Properties on every track call In addition to event-specific fields below, each forwarded `track` includes: | Property | Type | Description | | - | - | - | | `productIds` | `string[]` | Shopify product IDs for items in the shopper's look, when applicable. | | `variantIds` | `string[]` | Shopify variant IDs for items in the look, when applicable. | | `sessionId` | `string \| null` | Hemsy session ID for this tab visit (`sessionStorage`). | | `storeSlug` | `string` | Your Hemsy store subdomain slug. | | `source` | `string` | `browser` for shoppers, `stylist` for the in-store stylist embed. Filter on this to keep associate activity out of shopper metrics. | | `location_id` | `string` | Only on stylist events: the Shopify location the stylist selected. | Segment also receives `anonymousId` and an ISO `timestamp`. The same `sessionId` is attached to Shopify carts started from Hemsy as a hidden line-item property, `_hemsy_session_id`, so orders can be joined back to the session's events. ## Forwarded events ### Session and engagement | Segment event | When it fires | Event properties | | - | - | - | | **Hemsy Session Started** | Once per browser tab session when the visualization experience loads and analytics bootstraps. | - | | **Hemsy Session Engaged** | Once per session, 10 seconds after load (shopper remained in the experience). | - | ### Visualization funnel | Segment event | When it fires | Event properties | | - | - | - | | **Hemsy Try On Started** | Shopper starts visualization generation (photo + at least one item). | `selectedItemCount` | | **Hemsy Try On Completed** | Visualization succeeds and the new render is shown. | `selectedItemCount` | | **Hemsy Try On Failed** | Visualization fails, returns without a generated image, or the store cannot generate (plan limit reached, model provider missing). | `reason`: e.g. `no_product_images`, `Generation failed`, `LIMIT_EXCEEDED`, `MERCHANT_MODEL_PROVIDER_REQUIRED`; `status`: HTTP status when a response was received; `code`: Hemsy error code when the response carried one | ### Look building | Segment event | When it fires | Event properties | | - | - | - | | **Hemsy Added Item to Look** | Shopper adds a product variant to their look, or swaps one in. | `productTitle` | | **Hemsy Layer Changed** | Shopper edits a layer: adds a layer, swaps or removes its product, changes its color or size, changes a shared size, starts over, or leaves the flow. | `flow_id` (null outside flows), `layer` (step title, product title, or shared-size label; null for `start_over` / `exit_flow`), `action`: `add`, `swap`, `remove`, `edit` (color or size changed on the same product), `size` (shared size), `start_over`, or `exit_flow` | | **Hemsy User Photo Uploaded** | Shopper uploads a photo from their device. | - | | **Hemsy Model Photo Selected** | Shopper picks a photo from the model library. | `model_id` | ### Browse, filter, and search When the shopper adds an item from the full catalog: | Segment event | When it fires | Event properties | | - | - | - | | **Hemsy Filter Selected** | Shopper selects a category in Filter & Sort. | `filter_name`, `filter_scope` | | **Hemsy Sort Selected** | Shopper changes sort (not "Featured"). | `sort_name`: `price-low`, `price-high`, etc. | | **Hemsy Search Submitted** | Shopper submits a catalog search (Enter). | `query`, `result_count` | ### Share and checkout | Segment event | When it fires | Event properties | | - | - | - | | **Hemsy Checkout Clicked** | Shopper taps checkout (or cart handoff in embed `cart` mode). | `selectedItemCount`, `hasStorefrontToken`, `fromSharedLook`, `sharedLookShortId` | | **Hemsy Look Shared** | Shopper shares the render. | See [Hemsy Look Shared](#hemsy-look-shared) below. | ### Hemsy Look Shared This event fires on two different paths depending on whether **share links** are enabled for your store (`sharing_enabled` in Hemsy, or always on staging/preview hosts). | `type` | When | Segment properties | | - | - | - | | `share_link` | Share links are enabled. Hemsy creates a persisted share URL, then surfaces it to the shopper. | `shortId`, `shareUrl`, `storeSlug`, `selectedItemCount`, `usedNativeShare` | | `share_image` | Share links are disabled. Hemsy shares or downloads the visualization only (no share URL). | `storeSlug`, `selectedItemCount` | #### `usedNativeShare` vs `shareUrl` (`type: share_link` only) These answer different questions: | Property | What it tells you | | - | - | | `usedNativeShare` | **How** the link was surfaced: `true` if the browser native share sheet was used (`navigator.share` with the URL, common on mobile), `false` if Hemsy fell back to copying the link to the clipboard (typical on desktop when Web Share API is unavailable or fails). | | `shareUrl` | **What** link was shared: the URL recipients can open (for example `https://yourstore.com/?share=FreyjHz4` when redirecting to the store embed, or your hosted `https://{subdomain}.hemsy.ai/?share=…` URL). | Hemsy **always tries** the native share sheet first when `navigator.share` is available and the share completes without cancellation. If that is not available or fails (other than the user dismissing the sheet), Hemsy copies `shareUrl` to the clipboard and sets `usedNativeShare` to `false`. Cancelling the native sheet does **not** fire **Hemsy Look Shared**. `share_image` does not include `usedNativeShare` or `shareUrl`. That path uses the native share sheet with an image file when supported, otherwise a download. It is separate from the share-link pipeline in `createShareHandler`. ### Sharing | Segment event | When it fires | Event properties | | - | - | - | | **Hemsy Shared Look Opened** | When this event is reported through the browser events API. | `shortId` (when present) | > [!NOTE] > > Shared look opens are always counted in Analytics (Top Shares). Confirm > **Hemsy Shared Look Opened** in your Segment debugger for your traffic; > contact Hemsy if you need guaranteed Segment delivery on every open. ## Example track payload ```json theme={null} { "anonymousId": "visitor-42", "event": "Hemsy Try On Completed", "properties": { "selectedItemCount": 3, "productIds": ["123", "456"], "variantIds": ["789", "101112"], "sessionId": "a1b2c3d4-...", "storeSlug": "mystore" }, "timestamp": "2026-05-20T15:04:05.123Z" } ``` ## Testing 1. Save your Segment endpoint (and write key) in **Integrations**. 2. **Embedded experience:** Open Hemsy from your storefront with `data-hemsy-anonymous-id` set to a test ID (for example `segment-test-001`). 3. **Hosted experience:** Open `https://{subdomain}.hemsy.ai?anonymous_id=segment-test-001` and run through upload › add items › visualization › checkout. 4. In Segment **Sources › Debugger**, confirm `Hemsy *` track events with `anonymousId: segment-test-001`. If events are missing: * Confirm the integration shows **Connected**. * Confirm you are on the correct subdomain or embed slug. * Confirm the event is listed under [Forwarded events](#forwarded-events), not [Not forwarded](#not-forwarded-to-segment). ## Related docs * [Hemsy Embeds](/embeds/overview): embedded launch modes, `data-hemsy-anonymous-id`, cart vs checkout * Hemsy dashboard **Analytics**: aggregated KPIs and funnels (no Segment required) # Staging Source: https://docs.hemsy.ai/staging Test Hemsy changes on the staging environment before they reach production. Staging runs the latest pre-release build of Hemsy. Use it to check new features against your store before they ship to production. | Surface | Production | Staging | | - | - | - | | Shopper experience | `https://{subdomain}.hemsy.ai` | `https://staging.hemsy.ai/?store={subdomain}` | | Dashboard | `https://dashboard.hemsy.ai` | `https://staging.dashboard.hemsy.ai` | | Embed script | `https://hemsy.ai/hemsy-embed.js` | `https://staging.hemsy.ai/hemsy-embed.js` | ## Shopper experience Staging serves every store from one host, so you pick the store with `?store=` instead of a subdomain. Without `?store=`, staging shows the Hemsy landing page. ``` https://staging.hemsy.ai/?store=mystore ``` [Deep link](/deep-links) parameters work the same way. Add them next to `store`: ``` https://staging.hemsy.ai/?store=mystore&product=organic-cotton-duvet ``` ## Embed script Load the script from staging. The embed opens Hemsy from the same host that served the script, so every launcher on the page opens staging. Every other attribute stays the same as the [production install](/embeds/script). ```html theme={null} ``` The staging embed can be loaded from any page, including `localhost` and your own staging storefront, so you can test without changing your store's allowed domains. ## Dashboard Sign in at [staging.dashboard.hemsy.ai](https://staging.dashboard.hemsy.ai) to try dashboard changes before release.