Prerequisites — before implementing AI Try-On, complete the Cookie consent and Installation steps on the JS Library page. Kleep must not load until the visitor has consented via your CMP, and the library must be loaded site-wide.
AI Try-On is available on demand. If you’re unsure whether this feature is enabled for your account, contact your Kleep representative.
What AI Try-On does
AI Try-On lets shoppers see products on themselves. Clicking a Try it on button on your product page opens the virtual try-on in a full-screen overlay: the shopper takes one full-length photo of themselves (or imports one), and Kleep generates a photorealistic image of them wearing the product. Closing the overlay brings them back to your product page.Product feed requirements
AI Try-On is built from the product feed you already send to Kleep — no extra file is needed. For each product, Kleep picks one on-model photo among itsimages, crops the model’s head out of it, and generates the try-on from that photo. Your products file (see the Product template) must meet these conditions:
- Image URLs must be publicly accessible. Kleep downloads them server-side, so no authentication or hotlink protection, and standard formats (JPEG, PNG, WebP). Use the same high-resolution image as on your product page.
- Keep image URLs stable. Changing a product’s photo resets its try-on setup, and the product has to be activated again.
- New products aren’t picked up automatically yet. After a collection drop, tell your Kleep representative so the new products get set up.
Methods
kleep.vto — Open the virtual try-on
-
Add a button where you want the CTA on the product page:
-
Call
kleep.vtowhen the shopper clicks it:
We leave the markup and CSS styling of the button to you.
kleep.vto reuses the public_id, product_id and lang you passed to kleep.load, so make sure kleep.load ran first on the product page.Parameters
All parameters are optional whenkleep.load has been called on the page. Pass public_id, product_id and lang to open the try-on for another product, or on a page where kleep.load isn’t called. The other parameters connect the try-on to your page: analytics, A/B test and add to cart.
kleep.vto returns true when the try-on opens, false when a parameter is missing or a try-on is already open.
Behaviour
- The try-on opens in a full-screen overlay on top of your page. The page behind it doesn’t scroll.
- If your account requires it, the try-on opens on a consent screen. The shopper accepts it before taking a photo, at each opening, and can withdraw their consent later in the try-on. Contact your Kleep representative to enable it.
- If the try-on is switched off for your account, or your monthly try-on quota is used up, the try-on shows a “not available” screen instead of the camera (or instead of the result, if it happens during a generation). It comes back on its own once Kleep switches it on again or the quota resets, with no change on your side.
- The try-on’s texts can be changed for your site, language by language, from the Try-on tab of the Integration page of your Kleep Dashboard. Changes show in the try-on within about 2 minutes. The consent text isn’t edited there: each version is kept so that every recorded consent points to the exact text the shopper saw. To change it, send the new wording to your Kleep representative.
- Shoppers close it from inside the try-on (its close button, or Close on the result screen). If the try-on doesn’t load, the overlay shows its own ✕ button, and the Escape key closes it too. Only one overlay can be open at a time.
- Closing the try-on discards the result. The photo is discarded too, unless the shopper ticks Remember my photo on this device: it is then kept in their browser for 7 days, for your site only, and the next try-on offers to reuse it.
- Camera access requires HTTPS. If your site sends a
Content-Security-Policyheader with aframe-srcdirective, addhttps://vto.kleep.aito it.
Events
The try-on reports its funnel to your page, so you can follow it in your own analytics (Google Tag Manager, Adobe, Piano, etc.). Each event is pushed towindow.dataLayer as { event, kleep: params } and given to the onEvent callback. No photo and no personal data ever leave the try-on this way.
Every event also carries
public_id, product_id, vto_session_id (one per try-on opening), lang, device (mobile, tablet, desktop), timestamp (ms since epoch) and experiment when you passed one. Events can carry other fields, such as engine: they are internal, can change at any time, and should not be relied on.
error_type tells what went wrong:
These events describe the try-on itself. Keep sending your store’s standard events with
kleep.track (product_viewed, product_added_to_cart, checkout_completed): views, cart adds, orders and revenue are measured from them, not from the try-on events. On a page where kleep.load isn’t called, Kleep takes the retailer from data-public-id on the script tag, from public_id on the call — kleep.track("product_viewed", { public_id: "UUID", productId: "12345" }) — or from an earlier kleep.vto call on the page.Experiment groups
When you A/B test the try-on (AB Tasty, Kameleoon, your own split, etc.), tell Kleep which group each visitor is in. Kleep keeps the group on every event it receives, so the groups can be compared: try-on usage on one side, product views, cart adds, orders and revenue on both. Format.experiment is an object { name, variant } or the text "name:variant". The object is sent as that text, so { name: "pdp-tryon", variant: "B" } and "pdp-tryon:B" are the same group. Use the name of the test and the group of the visitor.
- The text is 1 to 64 characters long and has no space. A value that doesn’t fit is left out, with a warning in the browser console: the try-on still opens and the event is still sent, without a group.
- A single word such as
"tryon"is accepted and kept on the events, but nothing tells two tests or two groups apart, and the Dashboard doesn’t show it. Use"name:variant". - A group is its exact text:
"pdp-tryon:B"and"pdp-tryon:b"are two groups. Send the same text on every call and every page.
experiment field of both methods:
kleep.vto({ experiment }), for the visitors who get the try-on.kleep.track(event, { experiment, ... }), on the three standard events, for every visitor of the test.
kleep.vto, so kleep.track is the only place Kleep hears about them. Sending the three events with experiment is all Kleep needs to count them: there is nothing else to call for this group. Two conditions make the comparison fair:
- Send the three events for both groups, from the same pages and with the same rules. A group whose events are sent on fewer pages looks worse than it is.
- Send
experimenton each of the three events, includingcheckout_completedon the order confirmation page. An event without it belongs to no group.
kleep.load isn’t called, set data-public-id on the script tag or pass public_id on every kleep.track call: the control group has no kleep.vto call to set it. See kleep.track for the content of each event, including the price of the cart items.
Results. The A/B test card of the Try-on Analytics page of your Kleep Dashboard compares the groups: conversion rate, add-to-cart rate, revenue per visitor and average order value, each against the group named control (the largest group when none has that name), with the uplift and whether it is significant. A visitor counts in the group of their first event with experiment, and every add-to-cart and order they place afterwards counts for that group. A visitor seen in two groups of the same test is left out.
Add to cart from the result screen
When you pass bothgetSizes and addToCart, the result screen lists the sizes of the tried product under the generated image, with an Add to cart button. Sizes with quantity 0 or false are shown but can’t be chosen. Choosing a size and clicking the button calls your addToCart(variantId); the button then shows “Added to cart” or an error, and the shopper closes the try-on to find the item in the cart.
getSizesis called once the result is displayed. Entries withoutvariantIdorsizeare left out. Return an empty array to show no sizes. It has 5 seconds to answer.addToCartmust add the item to the cart your page uses (your cart API,dataLayer, etc.) and update your mini-cart if needed. It has 15 seconds to resolve.- Without these two parameters the result screen shows no size and no button: the shopper closes the try-on and adds the product from your page as usual.

