Developer SDK
Once try-on is on your store, an optional in-page object — window.TRYON_TECHNOLOGY — lets your developers connect it to the rest of your site. It's entirely optional: try-on works without touching it.
Identify your shopper
Set window.TRYON_TECHNOLOGY.userId to your own logged-in customer id (or a getUserId() function we call when a try-on runs). Every try-on is then grouped under that shopper in your dashboard. If you don't set one, we keep a private per-browser id in a first-party cookie, so a returning visitor's try-ons still group together.
React to what happens
Register callbacks under hooks — or with TRYON_TECHNOLOGY.on('result', …) — to run your own code as things happen: when a result is ready (onResult — show a “save to my looks” button, fire analytics), when a shopper picks a photo, when something goes wrong (onError), and more. Every event is also dispatched as a tryon:<event> browser event, so tools like Google Tag Manager can listen with no extra code.
window.TRYON_TECHNOLOGY = {
userId: currentUser.id, // group try-ons under your customer
shareResults: currentUser.optedIn, // show them in your dashboard (opt-in)
hooks: {
onResult: (r) => save(r.fittingImageUrl), // a result is ready
onError: (e) => track('tryon_error', e),
},
};Drive it from your own code
Open try-on from your own button with TRYON_TECHNOLOGY.open(), preload a photo the shopper already gave you so they skip the upload, read past results, or reset everything on logout. The methods include open and close, setPhoto and clearPhoto, getResults and getLastResult, retry, reset, and a ready promise.
// open from your own button, reusing a photo the shopper already gave you
TRYON_TECHNOLOGY.setPhoto(savedPhotoUrl);
document.querySelector('#try-it').onclick = () => TRYON_TECHNOLOGY.open();Respect shopper privacy
By default, a shopper's try-on is private and does not appear in your dashboard. When your shopper has agreed to share it, set shareResults to true — you control that permission — and those try-ons show up for your team. Nothing is ever shared without it.
Saving results reliably
The onResult callback is perfect for in-page experiences. To store results on your own systems for the long term, use webhooks (see Webhooks & reports) — they're delivered to your servers and don't expire, so they're the dependable record of every try-on.