<script> window.addEventListener('message', function (event) { if ( event.data && event.data.eventName === 'wizart_analytics' //base name of all wizart events && event.data.analyticsEventName === 'user_init' //exact name of triggered event (gallery_open, apply, etc.) ) { //some your action to monitor a user activity //payload contains all necessary data about triggered event //console.log(event.data.payload); //console.log(event.data.payload.user_identifier); //current user id. This id is instant for each sessions of the user. } }); </script>
This script is to be added to a page where the Wizart Visualizer is integrated (that is, on the home page, catalog pages, and/or product pages). The best place to put it is next to the Wizart integration script, for example, after it, but not before, in order to avoid receiving a null response. To make sure the script works properly, it is better to add it before the document.addEventListener("DOMContentLoaded", () => {});
script.
You can subscribe to any events listed below:
Event name | Description |
---|---|
launch_first_time | the first time the application was launched |
wizart_session_start | each time the application is launched |
wizart_session_finish | each time the application is closed |
gallery_open | the application (Visualizer) is open |
predefined_interior_selected | whether a pre-defined (default) interior was selected |
photo_uploaded | whether a photo was uploaded |
custom_interior_selected | whether a custom interior was selected |
custom_interior_deleted | whether an uploaded interior was deleted |
back_button_clicked | a user clicks on the back button and goes back to the client’s site |
brand_selected | whether any brand was selected |
collection_selected | whether any brand was selected |
article_selection | whether any product was selected |
apply | whether any products were applied |
add_to_favorite | whether any products were added to the Favorites |
remove_from_favorite | whether any products were removed from the Favorites |
Info | these are users' ‘Go to product page’ clicks |
rotate_flooring | these are users' flooring rotations ('Rotate flooring' button) in the Visualizer |
laying_patterns_selected | whether a user changed any flooring layouts ('Change layout' button) |
download_original | tracks original image (without any products applied) downloads (available for users' interiors only) |
download_result | tracks result image downloads |
download_result_with_info | tracks result image with information downloads |
share_image | tracks social media shares |
shopping_cart_open | tracks shopping cart page visits (within the Visualizer) |
shopping_cart_close | tracks shopping cart page closings (within the Visualizer) |
open_in_store | These are users' visits to the website to proceed with the purchase. It is triggered just once when a user goes to the website even with several products in the shopping cart (i.e. 3 products = 1 ‘open_in_store’ event) |
add_to_shopping_cart | tracks adding items to the shopping cart |
remove_from_shopping_cart | tracks item removals from the shopping cart |
+1_item | tracks increasing the item quantity in the shopping cart |
-1_item | tracks decreasing the item quantity in the shopping cart |
Some examples:
Event name | Script | Example |
---|---|---|
| window.addEventListener('message', function (event) { if ( event.data && event.data.eventName === 'wizart_analytics' //base name of all wizart events && event.data.analyticsEventName === 'gallery_open' //exact name of triggered event (gallery_open, apply, etc.) ) { console.log(event.data.payload.start_app); } }); | This script shows whether the Visualizer is open. The response is true. |
| window.addEventListener('message', function (event) { if ( event.data && event.data.eventName === 'wizart_analytics' //base name of all wizart events && event.data.analyticsEventName === 'apply' //exact name of triggered event (gallery_open, apply, etc.) ) { console.log(event.data.payload); } }); | This script shows whether a user applied any products. |