Help

Overview Admin Chat UI Design Curated Answers Search Settings Conversational Intelligence Data Sync Upload Documents Human Handoff Admin Console Authorisation Contact Support

Website Integration Script Tag

Airgentic Help

Configure the Airgentic script tag to control how the chat widget behaves on your website.


Basic Setup

Add the Airgentic script tag to your website pages, typically just before the closing </body> tag:

<script id="airgentic-script"
        src="https://chat.airgentic.com/_js/airgentic-1.4.js"
        data-account-id="YOUR_ACCOUNT_ID"
        data-service-id="YOUR_SERVICE_ID"
        defer></script>

Replace YOUR_ACCOUNT_ID and YOUR_SERVICE_ID with your actual values (available from your Airgentic administrator).


Script Tag Options

All options are added as data-* attributes on the script tag.

Required

Attribute Description
data-account-id Your Airgentic account identifier
data-service-id The service identifier for this website

Optional

Attribute Description Default
data-chat-icon-visible Show or hide the floating chat icon. Set to "true" or "false". Overrides the service-level setting in the admin console. Uses service config
data-chat-icon-button-id Element ID or class name of a button (or other clickable element) that opens the hover widget when clicked. Same effect as clicking the floating chat icon. If an element with that ID exists it is used; otherwise all elements with that class name are used.
data-user-id-cookie Cookie name to read on the page when sending user_id to Airgentic analytics. user_id not sent
data-airgentic-question-target-url URL to redirect visitors when they submit a question via an AI question input field. See AI Question Input Fields. Opens hover widget
data-search-input-id Element ID or class name of an existing search input to bind Airgentic Search to
data-search-button-id Element ID or class name of an existing search button to bind Airgentic Search to
data-autocomplete-input-id Element ID or class name of an existing search input to enhance with Airgentic autocomplete suggestions. Unlike data-search-input-id, this keeps the field editable on the page.
data-autocomplete-button-id Element ID or class name of an existing search button to click when an autocomplete query suggestion has no direct page URL. Useful for CMS search widgets.
data-autocomplete-input-xpath XPath expression for an existing search input to enhance with Airgentic autocomplete suggestions. Use only when an ID or class is not available.
data-search-autocomplete-min-chars Minimum number of typed characters before autocomplete suggestions appear. 2
data-search-autocomplete-submit-on-select Whether selecting an autocomplete suggestion opens direct result URLs or triggers the page's normal search behaviour. Set to "false" to only fill the input. true
data-autocomplete-theme Optional page-level autocomplete theme override. Use "light", "dark", "auto", or "transparent". If omitted, autocomplete follows the service's Search UI theme. Search UI theme

Option Details

Chat Icon Visibility

Control whether the floating chat icon appears on the page. This is useful when you want different behaviour on different pages of your website.

<!-- Always show the chat icon on this page -->
<script id="airgentic-script"
        src="https://chat.airgentic.com/_js/airgentic-1.4.js"
        data-account-id="YOUR_ACCOUNT_ID"
        data-service-id="YOUR_SERVICE_ID"
        data-chat-icon-visible="true"
        defer></script>
<!-- Hide the chat icon on this page (e.g., when using Service Hub only) -->
<script id="airgentic-script"
        src="https://chat.airgentic.com/_js/airgentic-1.4.js"
        data-account-id="YOUR_ACCOUNT_ID"
        data-service-id="YOUR_SERVICE_ID"
        data-chat-icon-visible="false"
        defer></script>

Priority order:
1. Page-level data-chat-icon-visible attribute (if set)
2. Service-level setting in the admin console
3. Default: chat icon is shown

Custom Chat Open Button

Use your own button or link to open the hover widget. When the element is clicked, the chat opens just as if the visitor had clicked the floating chat icon. Useful when you want a "Chat with us" or "Ask AI" button in your header, footer, or inline content.

ID or class: The attribute value is first treated as an element ID. If no element with that ID is found, it is treated as a class name and all elements with that class are bound (so multiple buttons can open the widget). Use the ID or class value only — no # or . prefix.

If the element already has a click handler (e.g. a link), Airgentic’s handler runs and prevents the default action so the widget opens instead of navigating.

<!-- By ID -->
<button id="open-chat-icon">Chat with us</button>

<script id="airgentic-script"
        src="https://chat.airgentic.com/_js/airgentic-1.4.js"
        data-account-id="YOUR_ACCOUNT_ID"
        data-service-id="YOUR_SERVICE_ID"
        data-chat-icon-button-id="open-chat-icon"
        defer></script>
<!-- By class (e.g. when your site uses dynamic IDs) -->
<div class="livechat_button">Live Chat</div>

<script id="airgentic-script"
        src="https://chat.airgentic.com/_js/airgentic-1.4.js"
        data-account-id="YOUR_ACCOUNT_ID"
        data-service-id="YOUR_SERVICE_ID"
        data-chat-icon-button-id="livechat_button"
        defer></script>

The hover widget must be enabled for your service; this option has no effect if you use Service Hub only without the floating chat.

Use this option when you want Airgentic to read a specific cookie value from the page and send it to the server as user_id for session analytics.

<script id="airgentic-script"
        src="https://chat.airgentic.com/_js/airgentic-1.4.js"
        data-account-id="YOUR_ACCOUNT_ID"
        data-service-id="YOUR_SERVICE_ID"
        data-user-id-cookie="_ga_BCIT"
        defer></script>

Notes:
- Set the attribute value to the exact cookie name on your website.
- user_id is only sent when this attribute is configured and the named cookie is present.
- If data-user-id-cookie is omitted, Airgentic does not send user_id.

AI Question Target URL

Redirect visitors to a dedicated AI support page when they submit a question via an AI Question Input Field.

<script id="airgentic-script"
        src="https://chat.airgentic.com/_js/airgentic-1.4.js"
        data-account-id="YOUR_ACCOUNT_ID"
        data-service-id="YOUR_SERVICE_ID"
        data-airgentic-question-target-url="/ai-support"
        defer></script>

The question is passed in the URL and submitted automatically on the target page. If not set, the hover widget opens on the current page to answer the question.

Search UI Binding

Connect Airgentic's Search UI to your existing search elements. When a visitor uses your site's search box, Airgentic intercepts the query and displays AI-powered search results.

<script id="airgentic-script"
        src="https://chat.airgentic.com/_js/airgentic-1.4.js"
        data-account-id="YOUR_ACCOUNT_ID"
        data-service-id="YOUR_SERVICE_ID"
        data-search-input-id="searchInput"
        data-search-button-id="searchButton"
        defer></script>

Notes:
- Use element IDs only (no # prefix) or class names (no . prefix)
- You can provide either input ID or button ID; Airgentic will bind to whichever you provide
- Providing both gives the best user experience

Search Autocomplete Binding

Enhance an existing search field with Airgentic autocomplete suggestions while keeping the field editable in the page.

<script id="airgentic-script"
        src="https://chat.airgentic.com/_js/airgentic-1.4.js"
        data-account-id="YOUR_ACCOUNT_ID"
        data-service-id="YOUR_SERVICE_ID"
        data-autocomplete-input-id="siteSearch"
        data-autocomplete-button-id="siteSearchButton"
        defer></script>

data-autocomplete-input-id is first treated as an element ID. If no element with that ID exists, it is treated as a class name, so the same script tag can target one or more inputs.

When a visitor selects a document-title suggestion, Airgentic opens the indexed page directly if the suggestion includes a URL. Query-only suggestions fall back to the page's normal search behaviour: first the closest form is submitted, then the configured data-autocomplete-button-id button is clicked, then an Enter key event is dispatched for CMS widgets such as Wix.

The autocomplete dropdown follows the service's Search UI theme. You can override it for a specific page with data-autocomplete-theme="dark", data-autocomplete-theme="light", data-autocomplete-theme="auto", or data-autocomplete-theme="transparent".

Set data-search-autocomplete-submit-on-select="false" when selecting a suggestion should only fill the field and should not navigate, submit, click a button, or trigger Enter.

Use data-search-input-id for overlay search. Use data-autocomplete-input-id for native autocomplete on an existing field.


Full Example

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>Your Page</title>
</head>
<body>
  <header>
    <input type="text" id="siteSearch" placeholder="Search..." />
    <button id="searchBtn">Search</button>
  </header>

  <main>
    <h1>Welcome</h1>
    <p>Your page content here.</p>
  </main>

  <script id="airgentic-script"
          src="https://chat.airgentic.com/_js/airgentic-1.4.js"
          data-account-id="YOUR_ACCOUNT_ID"
          data-service-id="YOUR_SERVICE_ID"
          data-chat-icon-visible="true"
          data-user-id-cookie="_ga_BCIT"
          data-search-input-id="siteSearch"
          data-search-button-id="searchBtn"
          defer></script>
</body>
</html>

See Also

You have unsaved changes