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
Hide the built-in launcher and nudge with the
hideDefaultUIconfig optionBuild a custom launcher button that opens/closes the widget with
toggle()Render a custom nudge from the
nudge:loaded,nudge:triggered, andnudge:hiddeneventsRun the standard nudge click behavior from your own UI with
clickNudge()
How It Works
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
Hide the default UI. Setting
hideDefaultUI: trueindocument.gleenConfigsuppresses both Alhena's floating launcher button and its built-in nudge. The widget itself still loads, and all nudge events still fire.Build your launcher. A plain
<button>callswindow.gleenWidget.toggle()to open and close the chat. Listening towidget:opened/widget:closedlets you swap the icon to reflect state.Prepare your nudge on
nudge:loaded. When a nudge matches the current page, thenudge:loadedevent delivers its text and button label. Populate your element but keep it hidden.Reveal on
nudge:triggered. When the standard trigger condition is met,nudge:triggeredfires — show your element.Hide on
nudge:hidden.nudge:hiddenfires 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.Click through with
clickNudge(). When the visitor clicks your nudge, callwindow.gleenWidget.clickNudge()so it fires the same analytics and opens the conversation exactly like the built-in nudge.
Related
JavaScript API -
toggle(),clickNudge(), and thehideDefaultUIconfig optionEvents Reference -
nudge:loaded,nudge:triggered, andnudge:hiddenAI Nudges - Configuring nudges in the dashboard
Last updated