Skip to main content
This reference covers the script embed method: the tag itself, the window.TarsConfig object, and what the widget receives from the host page.

The script tag

Copy the snippet from DistributeWidget Embed on the agent, under the HTML tab. Paste it before the closing </body> tag.
The widget host is not the API base URL. One host serves the widget for every region, and the region travels in data-region. The HTTP APIs use a per-region base URL instead, listed in API authentication. The script adds a floating launcher in a shadow DOM, so host-page CSS cannot break it. The widget iframe is preloaded when the page goes idle, or on first hover of the launcher, whichever comes first.

window.TarsConfig

Set window.TarsConfig before the script tag runs to pass options and data about the end user.
Values from TarsConfig are unverified browser data. They personalize the conversation but never overwrite a verified identity.

Locale resolution

The widget locale resolves in this order, using the first value present.
  1. TarsConfig.lang
  2. The host page’s ?lang= URL parameter
  3. The browser’s navigator.language
Only the primary language code is used, so en-US resolves to en.

Context passed to the widget

The script collects context and passes it to the iframe as a base64url ctx parameter, at the moment the iframe is built.
TarsConfig fields and page context combining into a base64url ctx value that is either sent to the iframe or trimmed when it exceeds the 6000 character cap
The encoded context is capped at 6000 characters. Over the cap, attributes is dropped first. If the remainder still exceeds the cap, no context is sent.

Appearance is fetched per page load

The launcher and widget appearance load live from Tars on every page load, with a 2-second timeout per attempt. A server error is retried twice before the launcher falls back to defaults. Design changes made in the dashboard apply without re-embedding.