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

Code Examples

Practical code examples demonstrating common Alhena Website SDK integration patterns.

This section contains ready-to-use code examples for common Alhena chat widget integration scenarios. Each example includes complete, working code that you can adapt for your website.

Available Examples

Example
Description
Use Case

Customize AI responses based on A/B test groups

Personalize answers for test vs control users

Automatically close the widget after human transfer

Clean up UI after support handoff

Switch to another support tool on human transfer

Use Freshworks, Zendesk, etc. for human agents

Configure widget language and locale

Multi-language websites

Show widget only after user scrolls

Reduce initial page load distraction

Replace the built-in launcher and nudge with your own

Match chat entry points to your design system

Customize how product prices are displayed

Currency conversion, variant-aware pricing

Track cart and checkout events in WooCommerce

E-commerce revenue attribution

Add an AI search button to Shopify predictive search

Send storefront search queries into the widget


Quick Start Template

All examples build on this basic setup:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Your Page</title>
  </head>
  <body>
    <!-- Your page content -->

    <!-- Alhena SDK -->
    <script>
      document.gleenConfig = {
        company: "your-company-key",
        apiBaseUrl: "https://app.alhena.ai",
      };
    </script>
    <script src="https://app.alhena.ai/sdk/gleenWidget.js"></script>

    <!-- Your custom integration code -->
    <script>
      // Event handlers and customizations go here
    </script>
  </body>
</html>

Example Categories

Widget Control

Learn how to programmatically control the chat widget:

Human Agent Handoff

Handle transitions from AI to human support:

Localization & Personalization

Support multiple languages and personalized experiences:

E-commerce

Customize product display and track revenue:


Need More Examples?

Check these related documentation pages:

Last updated