For the complete documentation index, see llms.txt. This page is also available as Markdown.

Custom Launcher & Nudge UI

Replace Alhena's built-in launcher and nudge with your own UI, driven by the same standard nudge logic via the Website SDK.

This example shows how to hide Alhena's default launcher button and nudge UI and render your own in their place — while still being driven by the same standard nudge logic (page matching, timer/scroll triggers, dismissal rules) configured in your dashboard.

This is useful when you want the chat entry point and proactive prompts to match your site's design system exactly, while keeping the targeting and behavior managed in Alhena.

What You'll Learn

How It Works

Piece
Role

hideDefaultUI: true

Hides Alhena's default launcher button and nudge UI. The nudge events still fire.

nudge:loaded

Fires when a nudge is matched for the current page — use it to populate (but keep hidden) your custom nudge.

nudge:triggered

Fires when the standard show logic activates (timer elapsed / scroll threshold met, widget closed, not dismissed) — reveal your nudge here.

nudge:hidden

Fires when the nudge should come down (dismissed, chat opened, FAQ widget used, page no longer matches) — hide your nudge here.

clickNudge()

Runs the same analytics + open-conversation behavior as the built-in nudge, so your custom nudge behaves identically.

Register your event handlers inside a widget:loaded handler (or after the SDK <script> tag) so the SDK is ready before you subscribe.

Code Example

Walkthrough

  1. Hide the default UI. Setting hideDefaultUI: true in document.gleenConfig suppresses both Alhena's floating launcher button and its built-in nudge. The widget itself still loads, and all nudge events still fire.

  2. Build your launcher. A plain <button> calls window.gleenWidget.toggle() to open and close the chat. Listening to widget:opened / widget:closed lets you swap the icon to reflect state.

  3. Prepare your nudge on nudge:loaded. When a nudge matches the current page, the nudge:loaded event delivers its text and button label. Populate your element but keep it hidden.

  4. Reveal on nudge:triggered. When the standard trigger condition is met, nudge:triggered fires — show your element.

  5. Hide on nudge:hidden. nudge:hidden fires whenever the nudge should come down — the visitor dismissed it, opened the chat, used the Product FAQ widget, or navigated to a page with no nudge. Hide your element.

  6. Click through with clickNudge(). When the visitor clicks your nudge, call window.gleenWidget.clickNudge() so it fires the same analytics and opens the conversation exactly like the built-in nudge.

Last updated