Skip to main content

AR Try-on Events

GlamAR SDK triggers all essential events for the user on every ui interaction, data change and api resolution. We will dive deep into these events and when and how to use them. First we will go over basic events.

Life Cycle Events​

loading​

Fired when the GlamAR module is initiated and the SDK proceeds with the loading process.

Don't call any other function before you receive the loaded event as it may cause misbehaviour due to incomplete initialization

GlamAR.addEventListener("loading", () => { console.log("GlamAR: Is Loading..."); })

loaded​

Fired when the GlamAR module initialization is completed

Use this event as a starting point to call any other function, as shown below

// Initialization Function
GlamAR.init("Your Contianer Id", "Your Access Key", { platform: "web" });

// Listen for loaded event
GlamAR.addEventListener("loaded", () => {
console.log("GlamAR: Loaded successfully");
// Continue with desired flow

// Example: apply a specific SKU
// GlamAR.applyBySku("valid-skuId");

// Example: apply a category by name
// GlamAR.applyByCategory("valid-subcategory");

// Example: start EyePD tracking
// GlamAR.eyePD("start");
});

opened​

Fired when GlamAR module starts showing any type of viewer ,i.e, Live Try-on, Model Try-on or Model Viewer

// Opens the GlamAR SDK or activates the AR session
GlamAR.open();

// Listen for the 'opened' event
GlamAR.addEventListener("opened", () => {
console.log("GlamAR: Opened successfully");
});

closed​

Fired when GlamAR module is told to stop working

// Closes the GlamAR SDK
GlamAR.close();

// Listen for the 'closed' event
GlamAR.addEventListener("closed", () => {
console.log("GlamAR: Closed successfully");
});

reset​

Fired when GlamAR module removes all the applied effects are reset. Use reset() without parameters to reset all applied effects. Use reset options only in multi-try-on flows when you need to reset specific SKUs or a specific subcategory.

// Resets all applied effects
GlamAR.reset();

// Multi-try-on only: resets specific SKUs or a subcategory
GlamAR.reset({ skuIds: ["sku-1"] });
GlamAR.reset({ subCategory: "blush" });

// Listen for the 'reset' event
GlamAR.addEventListener("reset", () => {
console.log("GlamAR: Reset successfully");
});

error​

Fired anytime an error occurs. This event returns Error object with a description of the error that has been encountered. If your toasts are active you will see the same message on screen. If you want to use your own error handling UI just listen to this event and show errors using the Error we send.

GlamAR.addEventListener("error", (error) => {
console.log("GlamAR: Error encountered", error);
});

Experience Change Events​

These events are emitted when the SDK switches between AR Try-On and Skin Analysis using setExperience.

EventPayloadDescription
experience-changing{ from, to }Fired when the SDK starts switching from one experience to another.
experience-changed{ experience }Fired when the selected experience is active.
experience-change-failed{ experience, error }Fired when the SDK cannot switch to the requested experience.

Web/React and React Native listeners receive the payload directly. Android, iOS, and Flutter receive a message with a payload field for SDK-emitted events. A native validation failure can deliver experience-change-failed directly; the examples handle both shapes.

GlamAR.addEventListener("experience-changing", (payload) => {
console.log("experience-changing", payload.from, payload.to);
});

GlamAR.addEventListener("experience-changed", (payload) => {
console.log("experience-changed", payload.experience);
});

GlamAR.addEventListener("experience-change-failed", (payload) => {
console.log("experience-change-failed", payload.experience, payload.error);
});

Camera Events​

camera-opened​

Fired when the camera is opened successfully.

camera-closed​

Fired when the camera is closed successfully.

camera-access-issue​

Fired when the camera fails. This can occur if the user refuses to grant permission or the app is unable to retrieve the video stream normally.

// Fired when the GlamAR camera is opened
GlamAR.addEventListener("camera-opened", () => {
console.log("GlamAR: Camera opened");
});

// Fired when the GlamAR camera is closed
GlamAR.addEventListener("camera-closed", () => {
console.log("GlamAR: Camera closed");
});

// Fired when camera permission is not granted
GlamAR.addEventListener("camera-access-issue", () => {
console.log("GlamAR: Camera permission not granted");
});

Try-on Events​

sku-applied​

Fired when a given SKU is applied successfully. The SDK event payload contains SKU identifiers and the applied SKU data.

FieldTypeDescription
skuIdstringID of the SKU that was applied. This is the same SKU ID present in data._id.
productNamestringProduct name of the applied SKU.
dataobjectFull SKU object used by the SDK for try-on. Common fields include _id, productName, productImage, category, subCategory, arEffect, meta, and status. Fields can vary by category and SKU configuration.

Example payload:

{
skuId: "00b0da0e-83fe-47d3-b6a1-f438bcabee49",
productName: "Berry Shimmer Lipstick",
data: {
"_id": "00b0da0e-83fe-47d3-b6a1-f438bcabee49",
"orgId": "16812040",
"category": "makeup",
"subCategory": "lipstick",
"isActive": true,
"status": "PUBLISHED",
"productName": "Berry Shimmer Lipstick",
"productImage": "https://cdn.pixelbin.io/v2/dummy-cloudname/dtSIl9/t.resize(w:282)~t.toFormat(f:webp)/Demo_Store/Icon_image/lipstick/04.png",
"brand": "Lakeme",
"barcode": "asfa",
"actionUrl": null,
"version": "1.0.0",
"arEffect": {
"colors": [
{
"color": "#ae4c57",
"colorId": 0
}
],
"styleID": "single",
"patterns": [
{
"_id": "matte",
"gloss": 60,
"fullness": 50,
"wrinkles": 50,
"innerRatio": 50,
"shimmerColor": "#ff0000",
"transparency": 50,
"blendStrength": 50,
"colorIntensity": 39,
"shimmerDensity": 50,
"shimmerIntensity": 45,
"shimmerGranularity": 50
}
]
},
"meta": {
"age": "",
"material": ""
},
"createdAt": "2025-09-24T12:27:49.427Z",
"updatedAt": "2026-05-13T12:24:45.104Z",
"collectionIds": null
}
}

The fields above describe the SDK payload. The callback argument depends on the platform:

PlatformRead the SKU configuration from
Web / Reactpayload.data
React Nativepayload.data from GlamAr.on(...)
AndroidThe callback JSONObject → payload → data
iOSThe callback dictionary → payload → data
Flutterevent['payload']['data']

Register the listener before applying the SKU. data contains the applied SKU configuration, including its category-specific arEffect; it is not only the SKU ID.

GlamAR.addEventListener("sku-applied", ({ skuId, productName, data }) => {
console.log("Applied SKU:", skuId, productName);
console.log("SKU configuration:", data);
});

GlamAR.applyBySku("valid-sku-id");

sku-failed​

Fired when a given SKU is not applied successfully. This can occur if there is some issue with SKU data or user's subscription has expired. Check the plan and usage for your GlamAR account in Fynd Console to make sure your plan is active and has enough credits.

GlamAR.addEventListener("sku-failed", () => {
console.log("SKU could not be applied. Check the SKU and your account plan.");
});

shade-finder​

Fired when the Shade Finder flow completes or fails. The SDK emits this event as shade-finder and forwards the same payload through the wrapper.

FieldTypeDescription
statusstringShade Finder processing status. Possible values are success or failed.
categorystringCurrent try-on category or subcategory associated with the Shade Finder scan, for example foundation.
responseobjectOn success, contains the Shade Finder output including detected shade, quality information, recommendations, and warnings. On failure, contains the error object, message, or API error response.

Example success payload:

{
status: "success",
category: "foundation",
response: {
schema_version: "1.1",
request_id: "8501aa61-31eb-4233-81f4-79a773e272c2",
status: "ok",
quality: {
passed: true,
score: 1,
rejection_reasons: []
},
detected_shade: {
hex: "#b58d6e",
confidence: 0.5,
depth: "medium",
undertone: "warm",
undertone_confidence: 0.85,
scales: {
fitzpatrick: 4,
monk: 6
},
zones: [
{
zone: "left_cheek",
hex: "#a87a59",
used_in_composite: true
}
]
},
recommendations: {
results: [
{
category: "foundation",
best_match: {
shade_id: "tarte-deep-6",
shade_name: "Deep",
brand: "tarte",
product: "BB blur natural matte tinted moisturizer Broad Spectrum SPF 30 Sunscreen",
hex: "#bd8b69",
undertone: "warm",
depth: "light_medium",
delta_e: 2.34,
rank: 1
},
top_matches: []
}
],
catalog_version: "2.0.0"
},
warnings: []
}
}
GlamAR.addEventListener("shade-finder", (payload) => {
const { status, category, response } = payload || {};
console.log("GlamAR: Shade Finder", status, category, response);
});

ring-measurement​

Fired throughout the Web SDK Ring Measurement lifecycle. The SDK uses one event name for readiness, completion, cancellation, retakes, and feature-specific errors.

FieldTypeDescription
optionsstringLifecycle state: ready, retake, complete, cancel, or error.
valueobjectState-specific data. A completed value contains flow and measurement; an error contains a code or reason and may include message and status.
GlamAR.addEventListener("ring-measurement", ({ options, value }) => {
if (options === "complete") {
const { flow, measurement } = value;
console.log("Ring measurement flow:", flow);
console.log("US size:", measurement.sizes.us);
console.log("UK size:", measurement.sizes.uk);
console.log("Indian size:", measurement.sizes.indian);
console.log("ISO size:", measurement.sizes.iso);
}

if (options === "error") {
console.error(value?.code || value?.reason, value?.message);
}
});

photo-loaded​

Fired when SDK is prompted to take a screenshot of the current AR effect. This event handles both success or failed conditions. The payload of this event contains two variables as follows:

  • image in base64 format
  • status in string format with possible values of success | failed

Below code example shows the complete cycle of function and event

// Prompts the GlamAR SDK to take a screenshot
GlamAR.snapshot();

// Listen for the photo-loaded event
GlamAR.addEventListener("photo-loaded", ({ image, status }) => {
console.log("GlamAR: Screenshot status:", status, "image data:", image);
});

UI Events​

ui-interaction​

Fired when a user interacts with any UI element. You can register these events to trigger specific actions or to track behavior on your side.
GlamAR provides its own analytics as well, but you can also log these for custom analytics.

UI elements have two behaviors:

  • clicked
  • toggleOn | toggleOff

topNavigationPanel​

Image

This is the top navigation panel. It has four buttons, each with an interaction event:

  • Clicked on Back button
  • Clicked on Global Cart button
  • Clicked on Share button
  • Clicked on Close button
UI ElementAction
backclicked
globalCartclicked
shareclicked
closeclicked
GlamAR.addEventListener("ui-interaction", ({ screenType, buttonType, value }) => {
console.log("GlamAR: UI event:", screenType, "interacted with:", buttonType, "value:", value);
if (screenType === "topNavigationPanel") {
if (buttonType === "back") { /* Back button clicked */ }
if (buttonType === "globalCart") { /* Global Cart button clicked */ }
if (buttonType === "share") { /* Share button clicked */ }
if (buttonType === "close") { /* Close button clicked */ }
}
});

vtoHeroScreen​

Image

This is the first screen displayed when the SDK initializes correctly and the UI is not overridden.

  • Clicked on Live Camera button
  • Clicked on Choose a Model button
UI ElementAction
LiveCameraclicked
ChooseAModelclicked
GlamAR.addEventListener("ui-interaction", ({ screenType, buttonType }) => {
console.log("GlamAR: UI event:", screenType, "interacted with:", buttonType);
if (screenType === "vtoHeroScreen") {
if (buttonType === "LiveCamera") { /* Live Camera button clicked */ }
if (buttonType === "ChooseAModel") { /* Choose a Model button clicked */ }
}
});

skuSelectionPanel​

Image

Displayed when any category is applied correctly. If there are multiple SKUs, this panel allows selecting one.

  • Clicked on Add to Cart button
  • Clicked on Add to Wishlist button (the heart icon)
UI ElementAction
addToCartclicked
addToWishlistclicked
GlamAR.addEventListener("ui-interaction", ({ screenType, buttonType }) => {
console.log("GlamAR: UI event:", screenType, "interacted with:", buttonType);
if (screenType === "skuSelectionPanel") {
if (buttonType === "addToCart") { /* Add to Cart clicked */ }
if (buttonType === "addToWishlist") { /* Add to Wishlist clicked */ }
}
});

modelScreen​

Image

Shown when any SKU is applied correctly and the user chooses Choose a Model. Users can select a model or upload their own.

  • Clicked on Upload button
  • Clicked on Confirm button
UI ElementAction
uploadclicked
confirmclicked
GlamAR.addEventListener("ui-interaction", ({ screenType, buttonType, value }) => {
console.log("GlamAR: UI event:", screenType, "interacted with:", buttonType, "value:", value);
if (screenType === "modelScreen") {
if (buttonType === "upload") { /* Upload button clicked */ }
if (buttonType === "confirm") { /* Confirm button clicked */ }
if (buttonType === "selectModel") { /* Model index selected: value */ }
}
});

eyePdToast​

Image

EyePD toast showing the default PD value.

  • Clicked on Measure Now button
UI ElementAction
measureNowclicked
GlamAR.addEventListener("ui-interaction", ({ screenType, buttonType }) => {
console.log("GlamAR: UI event:", screenType, "interacted with:", buttonType);
if (screenType === "eyePdToast") {
if (buttonType === "measureNow") { /* Measure Now button clicked */ }
}
});

eyePdInstructionScreen​

Image

UI ElementAction
startNowclicked
GlamAR.addEventListener("ui-interaction", ({ screenType, buttonType }) => {
console.log("GlamAR: UI event:", screenType, "interacted with:", buttonType);
if (screenType === "eyePdInstructionScreen") {
if (buttonType === "startNow") { /* Start Now button clicked */ }
}
});

eyePdResultPopup​

Image

UI ElementAction
proceedclicked
retakeclicked
GlamAR.addEventListener("ui-interaction", ({ screenType, buttonType }) => {
console.log("GlamAR: UI event:", screenType, "interacted with:", buttonType);
if (screenType === "eyePdResultPopup") {
if (buttonType === "proceed") { /* Proceed button clicked */ }
if (buttonType === "retake") { /* Retake button clicked */ }
}
});

modelViewerScreen​

Image

This is the 3D Model Viewer screen. From left to right, each element emits a ui-interaction event on interaction.

UI ElementActionDescription
showDimensionsclickedShow dimensions panel
ARclickedBack to selected try-on
viewInYourSpaceclicked

On compatible mobile devices launches AR view. On desktop shows a QR code to scan

fullScreenclickedToggle full-screen view
qrCloseclickedClose the QR code popup
GlamAR.addEventListener("ui-interaction", ({ screenType, buttonType }) => {
console.log("GlamAR: UI event:", screenType, "interacted with:", buttonType);
if (screenType === "modelViewerScreen") {
if (buttonType === "showDimensions") { /* Show dimensions button clicked */ }
if (buttonType === "AR") { /* Back to selected try-on button clicked */ }
if (buttonType === "viewInYourSpace") { /* View in your space button clicked */ }
if (buttonType === "fullScreen") { /* Full screen button clicked */ }
if (buttonType === "qrClose") { /* QR close button clicked */ }
}
});

comparePanel​

Image

Comparison UI emits events for the following interactions:

  • Clicked on Set Default button
  • Clicked on Close (X) button
UI ElementAction
closeclicked
defaultclicked
GlamAR.addEventListener("ui-interaction", ({ screenType, buttonType }) => {
console.log("GlamAR: UI event:", screenType, "interacted with:", buttonType);
if (screenType === "comparePanel") {
if (buttonType === "close") { /* Close button clicked */ }
if (buttonType === "default") { /* Set Default button clicked */ }
}
});

settingsPanel​

Image

The settings panel differs for each category. The image above is for the eyewear category. Other buttons and UI elements are shown for different categories. Buttons include:

  • Clicked on Close (X) button
  • Clicked on Measure button
  • Clicked on Redo Measurement button
  • Clicked on Position button
  • Clicked on Intensity button
  • Clicked on Finger button
GlamAR.addEventListener("ui-interaction", ({ screenType, buttonType }) => {
console.log("GlamAR: UI event:", screenType, "interacted with:", buttonType);
if (screenType === "settingsPanel") {
if (buttonType === "close") { /* Close button clicked */ }
if (buttonType === "pdMeasurement") { /* Measure button clicked */ }
if (buttonType === "redoMeasurement") { /* Redo Measurement button clicked */ }
if (buttonType === "positionAdjustment") { /* Position button clicked */ }
if (buttonType === "intensity") { /* Intensity button clicked */ }
if (buttonType === "fingerSelection") { /* Finger button clicked */ }
}
});

somethingWentWrongScreen​

Image

This is the main error screen that appears if the ML model or SKU fails to load.

  • Clicked on Choose different method button
GlamAR.addEventListener("ui-interaction", ({ screenType, buttonType }) => {
console.log("GlamAR: UI event:", screenType, "interacted with:", buttonType);
if (screenType === "somethingWentWrongScreen") {
if (buttonType === "chooseDifferentMethod") { /* Choose different method button clicked */ }
}
});

cameraFailed and cameraAccessDenied​

Image

These are camera-related error screens that appear if the camera fails to load properly or access is denied.

  • Clicked on Choose different method button
GlamAR.addEventListener("ui-interaction", ({ screenType, buttonType }) => {
console.log("GlamAR: UI event:", screenType, "interacted with:", buttonType);
if (screenType === "cameraFailed" || screenType === "cameraAccessDenied") {
if (buttonType === "chooseDifferentMethod") { /* Choose different method button clicked */ }
}
});

restartPopUp​

Image

Restart popup used in EyePD flow and Skin Analysis flow.

  • Clicked on No button
  • Clicked on Yes, restart button
GlamAR.addEventListener("ui-interaction", ({ screenType, buttonType }) => {
console.log("GlamAR: UI event:", screenType, "interacted with:", buttonType);
if (screenType === "restartPopUp") {
if (buttonType === "no") { /* No button clicked */ }
if (buttonType === "yes") { /* Yes, restart button clicked */ }
}
});

quitPopUp​

Image

Quit confirmation popup used in EyePD and Skin Analysis flows.

  • Clicked on No button
  • Clicked on Yes, quit button
GlamAR.addEventListener("ui-interaction", ({ screenType, buttonType }) => {
console.log("GlamAR: UI event:", screenType, "interacted with:", buttonType);
if (screenType === "quitPopUp") {
if (buttonType === "no") { /* No button clicked */ }
if (buttonType === "yes") { /* Yes, quit button clicked */ }
}
});

toast​

Image

Default toast shown for errors encountered.

  • Clicked on Close (X) button
GlamAR.addEventListener("ui-interaction", ({ screenType, buttonType }) => {
console.log("GlamAR: UI event:", screenType, "interacted with:", buttonType);
if (screenType === "toast") {
if (buttonType === "close") { /* Close button clicked */ }
}
});

add-to-cart​

Fired when user clicks on add to cart button of any particular SKU. This event returns two variables inside its payload,

  • skuId in string format
  • productName in string format

This can be used to identify which product was selected to add to cart. On your end, you can add it to the cart or do anything required, and then if you want SDK's UI to reflect this confirmation that required action was completed, you will have to call

// Listen for the 'add-to-cart' event
GlamAR.addEventListener('add-to-cart', ({ skuId, productName }) => {
console.log("GlamAR: Add to cart:", productName, "id:", skuId);

// Perform your add-to-cart operation in your system
// ...

// Notify the SDK that the item was successfully added
GlamAR.addedToCart(skuId);
// Note: skuId must match the one received from the event

});

add-to-wishlist​

Fired when user clicks on the heart icon of any particular SKU. This event returns two variables inside its payload,

  • skuId in string format
  • productName in string format

This can be used to identify which product was selected to add to wishlist. On your end, you need can add it to the wishlist or do anything required, and then if you want SDK's UI to reflect this confirmation that required action was completed, you will have to call

// Listen for the 'add-to-wishlist' event
GlamAR.addEventListener('add-to-wishlist', ({ skuId, productName }) => {
console.log("GlamAR: Add to wishlist:", productName, "id:", skuId);

// Perform your add-to-wishlist operation in your system
// ...

// Notify the SDK that the item was successfully added
GlamAR.addedToWishlist(skuId);
// Note: skuId must match the one received from the event

});

add-to-cart-global​

Fired when user clicks on the cart icon in the top navigation bar. This is can be used to open your own cart section, to show all the items in cart.

// Listen for the 'add-to-cart-global' event
GlamAR.addEventListener('add-to-cart-global', () => {
console.log("GlamAR: Open Global Cart clicked");

// Open your own global Cart section in your app
// ...

// If desired, close the SDK after opening the cart
// GlamAR.close();

});

Advanced Events​

subscription-invalid​

Fired when the subscription is found to be invalid or expired. Check the plan and usage for your GlamAR account in Fynd Console to make sure your plan is active and has enough credits.

// Listen for the 'subscription-invalid' event
GlamAR.addEventListener('subscription-invalid', () => {
console.log("GlamAR: Subscription has expired or credits consumed. Check plan status in console");
});

upload-started​

Fired when the upload mode dialogue is shown. This is during Ar-tryon when user goes to Model try-on and wants to add his own image. When he starts the process we trigger this event

upload-cancelled​

Fired when the upload mode dialogue is canceled.

GlamAR.addEventListener('upload-started', () => {
console.log("GlamAR: User started uploading their own model image to use");
});

GlamAR.addEventListener('upload-cancelled', () => {
console.log("GlamAR: User cancelled uploading model image");
});

overriden-ui-action​

Fired when any UI that is prompted to be shown but has been deactivated from GlamAR console. User inside custom code can toggle ui as per his need. So when inside SDK that particular UI is supposed to activate, instead of activating it, it will send this event with two variables

  • type in string | with possible values of popup|screen as values
  • name in string | with possible value of name of any overriden ui available

Note: Restart popup is dependent on the category choosen, it shows up for EyePD flow and Skin Analysis flow. So if you override this popup it will not show up for both cases

Image

// If 'heroScreen' has been overridden, this triggers once the SDK loads successfully after 'init'
GlamAR.addEventListener('overriden-ui-action', ({ type, name }) => {
console.log("GlamAR: type", type, "name", name);
if (type === "screen" && name === "heroScreen") {
// Show your own hero screen
// Show your own UI for Live TryOn or Model TryOn
// Call GlamAR.open() and GlamAR.open("imgTryOn") respectively
}
});

// If 'quit' has been overridden, this triggers when the popup opens after 'X' icon is clicked
GlamAR.addEventListener('overriden-ui-action', ({ type, name }) => {
console.log("GlamAR: type", type, "name", name);
if (type === "popup" && name === "quit") {
// Show your own quit popup
// 'No' just closes the popup
// 'Yes' call GlamAR.close()
}
});