Widget JavaScript controls and events
Use ShopFlare's browser-side widget controls for custom open buttons and lifecycle events without privileged API credentials.
Use the public browser interface
The current chatbot loader exposes window.ShopflareWidget. Its controls include open(), close(), toggle(), hide(), show(), and destroy(). These control the embedded experience, not workspace administration. Wait for the loader to initialise before using them, and test against the current snippet from your dashboard.
Connect a custom button
Attach this handler from your own JavaScript after the button exists. It opens an already installed widget; it does not install a widget or bypass consent. If the loader is not ready, show an appropriate loading or unavailable state in your own interface.
const button = document.querySelector("#open-shop-chat");
button?.addEventListener("click", () => {
if (window.ShopflareWidget) {
window.ShopflareWidget.open();
}
});Listen without collecting unnecessary data
The loader emits browser events such as shopflare:ready, shopflare:open, shopflare:close, shopflare:chat-started, shopflare:lead-created, and shopflare:error. A ready event can occur while consent is still required. Do not log complete event payloads or customer details into public analytics. Bind handlers once and remove them when your integration is torn down.
Dashboard labels may currently be in German. Available controls and modules depend on your package and release. If a control described here is missing, check your workspace or contact support.
Still need a hand?
Tell us what you’re trying to do. Please leave out passwords and personal customer data.