Widget Embed

The widget is a single <script> that loads a floating button and, on click, an iframe with the chat UI. The script runs inside a Shadow DOM so it can't collide with your site's CSS.

Basic embed

<script
  src="https://lxaira.com/api/widget/script?projectId=YOUR_PROJECT_ID"
  async
></script>

Put it before </body>. That's the whole install.

Query parameters

The script URL accepts the following parameters:

Parameter Required Values Description
projectId yes string Your project ID. Find it in the URL of your project dashboard.
lang no EN or PT Pre-select the widget language. If omitted, the widget auto-detects or uses the project default.

Example with language pinned to Portuguese:

<script
  src="https://lxaira.com/api/widget/script?projectId=YOUR_PROJECT_ID&lang=PT"
  async
></script>

Allowed domains

The server refuses to deliver the script to a domain that isn't on the project's allowed-domains list. Set this under Settings → Widget → Allowed Domains before testing on a new hostname.

See Security for details on how the origin check works and how to develop against localhost.

Shadow DOM isolation

The widget mounts into a Shadow DOM so your site's CSS won't leak into the chat and vice versa. You don't need to add any wrapping divs or CSS scoping.

Caching

The script response sends Cache-Control: private, max-age=60, must-revalidate. Config changes made in the dashboard propagate to visitors within a minute.

Removing the widget

Delete the <script> tag, or disable the widget in the project's Widget settings (which makes the script URL return a 404).

Widget Embed — Docs — Aira