Clickable options such as buttons and dropdowns fire the following events on activation and deactivation:
PRODUCT_BUILDER_OPTION_ACTIVATE
PRODUCT_BUILDER_OPTION_DEACTIVATE
You can use them in your external scripts when you want to track user actions.
Usage example with jQuery library:
$(document.body).on('PRODUCT_BUILDER_OPTION_ACTIVATE', function(e) { const data = e.originalEvent.detail;
console.log('option activated', data); });
You will receive an object with data about the option with which the action was performed, the category and the panel in which this option is located:
{option, category, panel}
In pure JS, an example would look like this:
function optionEventHandler(e) {
const data = e.detail;
console.log('option activated', data);
}
document.body.addEventListener('PRODUCT_BUILDER_OPTION_ACTIVATE', optionEventHandler);
Comments
0 comments
Please sign in to leave a comment.