Developers

Triggers

Every way to open the widget from your page — configured triggers, declarative CTA attributes, and the ready event.

Trigger types

Triggers are configured in the dashboard and mounted automatically (except in API mode, which suppresses the floating launcher).

  • Floating launcher — the circular / online-pill launcher. One per widget.
  • Inline button — a styled button injected into a placeholder you place in your HTML:
<div data-glimpze-trigger="YOUR_TRIGGER_ID"></div>

Declarative open — data-glimpze-cta

Add data-glimpze-cta="true" to any element to make it open the widget on click. Handled via a delegated listener, so elements added later (e.g. after a SPA route change) work too.

<button type="button" data-glimpze-cta="true">Open chat</button>

glimpze:triggers-ready

Once the widget has booted it dispatches a glimpze:triggers-ready event on window carrying the widget's triggers and prefillable fields. It's a reliable signal that window.GlimpzeWidget is ready to call.

window.addEventListener('glimpze:triggers-ready', (event) => {
  const { widgetId, triggers, fields } = event.detail;
  // fields === GlimpzeWidget.getFields()
});