Skip to main content

Custom events

ScentBot communicates with your application through browser Custom Events. Use these events to integrate with your cart, analytics, or UI state. All events are dispatched on the window object.

Events emitted by ScentBot

Listen for these events to react to user actions inside the widget.

sxp.scentbot.ready

Fired when the widget has finished initializing and is ready for interaction.

sxp.scentbot.addToCart

Fired when a user clicks the buy button on a perfume card and no direct purchase URL is available. Use this to add the product to your cart programmatically.
Event detail:

sxp.scentbot.exit

Fired when the user closes the widget.

Control ScentBot

Dispatch these events to control the widget from your application code.

sxp.scentbot.set

Update the widget state programmatically. The most common use case is opening or closing the widget:
This event is particularly useful when the widget is in controlled mode (controlled="true"), where the open/close state is fully managed by your application.

Cart integration example

A typical integration listens for addToCart, adds the item to the cart, and notifies ScentBot of the result:
Feedback events: ScentBot uses these feedback events to display appropriate success or error messages to the user.

Next steps

Configuration

All widget attributes for customizing behavior and appearance.

Capabilities

Search types, image search, multi-language, and session persistence.