Skip to main content

Events

Neo Beauty Studio includes real-time event reporting capabilities, allowing you to monitor and record user interactions and behaviours within the virtual makeup experience. With this feature, you can track and analyse user engagement, gain valuable insights into user preferences and pain points, and make data-driven decisions to improve the overall user experience.

All events are transmitted in real-time between the iFrame and parent host page, enabling you to stay up-to-date with user activity and respond quickly to any issues that may arise.

Capturing Events

To listen to all internal events from the iFrame, you can add the following script to your page, which will subscribe to events from the iFrame:

// Add window event listener functions
if (window.addEventListener) {
window.addEventListener(`load`, handleForm, false);
window.addEventListener(`message`, handleMessage, false);
}

// Subscribe to events when iFrame has loaded
function handleForm() {
: Subscribe to events
var win = document.getElementById(`bbh-iframe`).contentWindow;
win.postMessage(`subscribe`, `*`);
}

// Handle event messages
function handleMessage(e) {
const event = e.data;
: [Respond to event messages here]
console.log(`Neo Beauty Studio Event: message[${event.message}] data: [${event.data}]`);
}

This script subscribes to all events emitted from the iFrame, and the handleMessage function allows you to respond to these events. You can customise your response based on the message field and access the data payload in the data field.

Event responses are JSON-formatted and include the following fields:

interface Event {
message: MsgType;
data: any | null;
}

The message field specifies the type of event, and the data field contains any additional data related to the event.

We recommend that you work with our support team to define the events that you want to track and the data that you want to capture. By customising your event handling, you can gain valuable insights into user behaviour and preferences, which can help you to make informed decisions about product development, marketing, and customer engagement.

Events List

Neo Beauty Studio emits events to track user interactions and behaviours within the virtual makeup experience. You can use these events to gain insights into how users engage with your products and improve the overall user experience.

The following table lists the events that Neo Beauty Studio emits, along with a brief description and the expected data fields:

Event NameDescriptionExpected Data Fields
photo_button_clickUser clicked the "Take Photo" buttonNone
session_startedNew session started{ client_id: string, version: string, origin: string, window_size: { width: number, height: number }, device_info: object, device_flags: { is_mobile: boolean, is_desktop: boolean, is_tablet: boolean } }
subscribedParent page has subscribed to message service{ version: string, origin: string }
onboarding_page_loadOnboarding page loadedNone
window_resizeWindow resize event detected{ window_size: { width: number, height: number } }
get_started_click"Get Started" button clicked on onboarding pageNone
start_page_loadStart page loadedNone
launch_with_camera_click"Launch Camera" button clicked on start pageNone
launch_with_image_upload_click"Image Upload" button clicked on start pageNone
launch_with_image_upload_pickedUser selected an image to uploadNone
upload_page_loadUpload image page loadedNone
upload_page_complete_clickUser clicked "Use Photo" on upload steps pageNone
upload_page_cancel_clickUser clicked "Cancel" on upload steps pageNone
upload_page_rotate_clickUser clicked "Rotate" on the image upload page{ rotation: number }
upload_page_zoom_clickUser clicked "Zoom" on the image upload page{ zoom: number }
upload_page_flip_clickUser clicked "Flip" on the image upload page{ direction: 'vertical' | 'horizontal' }
vto_page_loadedMain VTO page loadedNone
take_photo_navigation_button_clickedUser clicked "Take Photo" from navigation buttonsNone
slider_toggle_button_clickedUser clicked "Slider Toggle" buttons{ status: boolean }
filter_toggle_navigation_button_clickedUser clicked "Filter Toggle" from navigation buttons{ status: boolean }
close_take_photo_page_clickUser clicked to close take photo pageNone
download_photo_clickUser clicked to download a photo{ products: Product[], image: string }
photo_capturedPhoto captured of user wearing makeup{ products: Product[], image: string }
share_photo_clickUser clicked to share a photo{ products: Product[], image: string }
share_look_clickUser clicked to share a look{ products: Product[] }
slider_thumb_dragUser repositioned the side-by-side slider{ position: number }
swiper_product_line_updatedSwiper product shade list updated by line{ products: Product[] }
swiper_product_shade_selectedProduct shade selected in swiper shade section{ product: Product }
swiper_product_shade_clickedUser clicked product shade swatch{ product: Product }
swiper_expandUser expanded the swiper barNone
swiper_collapseUser collapsed the swiper barNone
shop_your_look_clickedUser clicked "Shop Your Look" on top left{ products: Product[] }
shop_view_loadThe shopping bag view was loaded{ products: Product[] }
shop_view_product_info_toggle_clickUser clicked to toggle extra product information section{ status: boolean, product: Product }
shop_view_back_clickUser clicked to return from shopping bag viewNone
shop_add_product_clickUser clicked to add single product to bag{ product: Product }
shop_add_all_products_clickUser clicked to add all products to bag{ products: Product[] }
product_bar_updatedList of products in product bar updated{ products: Product[] }
product_bar_look_updatedList of looks in product bar updated{ look: Look }
product_bar_product_clickUser clicked product in product bar{ product: Product }
product_bar_remove_product_clickUser clicked x to remove product in product bar{ product: Product }
product_bar_add_product_clickUser clicked add productNone
product_bar_add_product_shade_view_loadSelect product shade list view loaded{ product_type: string, line: object, products: Product[], }
product_bar_add_look_view_loadAdd look view loaded{ looks: Look[] }
product_bar_add_look_back_clickUser clicked back button in add look viewNone
product_bar_add_look_clear_clickUser clicked clear all products in add look viewNone
product_bar_add_look_swatch_clickUser clicked on a look swatch in the add look view{ look: Look }
product_bar_add_look_confirm_clickUser clicked confirm in response to change of look in add look view{ look: Look }
product_bar_add_look_cancel_clickUser clicked cancel in response to change of look in add look viewNone
product_bar_add_product_back_clickUser clicked back button in add product viewNone
product_bar_add_product_clear_clickUser clicked clear all products in add product viewNone
product_bar_add_product_swatch_clickUser clicked on a product shade swatch in the add product view{ product: Product }
product_bar_add_line_clear_clickUser clicked clear all products in add line viewNone
product_bar_add_line_back_clickUser clicked back button in add line viewNone
product_bar_add_line_view_loadAdd line view loaded{ lines: Line[] }
product_bar_add_line_clickUser clicked on a line in the add line view{ selected_line: Line }
product_bar_add_category_loadAdd category view loadedNone
product_bar_add_category_back_clickUser clicked back button in add category viewNone
product_bar_add_category_clear_clickUser clicked clear all products in add category viewNone
product_bar_add_category_clickUser clicked on a category in the add category view{ category: string }
product_bar_add_category_looks_clickUser clicked on looks in the add category view{ looks: Look[] }
sdk_pausedSDK has been pausedNone
sdk_playSDK has restartedNone
sdk_set_feed_to_cameraSDK setting to live camera feedNone
sdk_initialisingSDK has started to initialiseNone
sdk_initialisedSDK has started to initialise{ build_info: object }
sdk_send_productsSDK sent products to render{ products: Product[] }
sdk_set_feed_to_staticSDK setting to static camera feedNone
sdk_toggle_visibilitySDK toggled visibility{ value: boolean }
sdk_capture_photo_startSDK requested capture live try-on imageNone
sdk_captured_photoSDK captured an image of the live try-on{ image: string }
sdk_play_artSDK started ART animation{ animation: string, loop: boolean }
sdk_end_artSDK ended ART animationNone
sdk_image_manipulationSDK set input image manipulation{ type: 'rotate' | 'zoom' | 'flip' , value: number | { x: number, y: number } }
sdk_set_client_idSDK set clientID{ clientid: string }
sdk_sdk_failed_startSDK failed to start{ code: number, response: string }
sdk_sdk_startedSDK started{ code: number, response: string }
add_bag_launch_external_linkLaunch external link from add to bag click{ link: string }
add_bag_launch_external_link_failedFailed to launch external link{ link: string, error: object }
journey_resetApp requested resetNone

These events can be accessed and analysed by adding event listeners to your parent web page, as detailed in our event handling documentation. By tracking these events, you can gain valuable insights into how users engage with your virtual makeup experience, and use this information to improve the overall user experience.