window once its script has loaded:
| Global | Use it for |
|---|---|
window.Kelu | The six core functions and every event, called as Kelu("open", { query }) or Kelu.open(). Works before the script loads with a preinitialization stub. Same shape as kapa.ai’s window.Kapa |
window.KeluWidget | The full API: init(), open, close, expand, ask, reset, change source groups, set the signed-in user, subscribe to events |
- Functions: open, close, render and unmount the widget, and change which source groups it answers from.
- Events: every interaction, from the panel opening to an answer being rated, for Segment, Mixpanel, Amplitude or your own endpoint.
- Preinitialization: call functions and subscribe to events before the script has loaded.
- Widget lifecycle: render and unmount by hand, for single-page apps that show the widget on some routes only.
The two globals side by side
window.Keluwaits for the widget.Kelu("open")called while the widget is still loading opens it once it is ready.KeluWidget.open()at that moment does nothing.- Spelling.
window.KeluhassetSourceGroupIDs;window.KeluWidgethassetSourceGroupIds.
Code written for kapa.ai’s
window.Kapa works with window.Kelu once you change the name. The widget does not define window.Kapa.window.KeluFormDeflector. See Rendering manually.