Widget integration

Drop an AI chat bubble onto any website with a single script tag, backed by one of your DaRetriva agents. Get your embed snippet from Admin → AI Agents → your agent → the Chatbot tab.

1. Add the script tag

Paste this before the closing </body> tag of your site. Nothing else is required — the bubble appears automatically.

<script
  src="https://daretriva.com/widget/loader.js"
  data-token="YOUR_WIDGET_TOKEN"
  async
></script>

2. Set the initial language (optional)

Add data-lang to have the widget start in a specific language (en, fr, de, es, or ar). Without it, the widget detects the visitor's browser language.

<script
  src="https://daretriva.com/widget/loader.js"
  data-token="YOUR_WIDGET_TOKEN"
  data-lang="fr"
  async
></script>

3. Change the language at runtime

If your own site has a language switcher, call this to update an already-mounted widget in place — no page reload needed:

window.DaretrivaWidget?.setLanguage('de');

Customization

Greeting, placeholder, limits, and the default avatar and brand color are set in the Chatbot tab. The one-line script does not need to change for that.

  • Greeting message and input placeholder, per language
  • Brand color and bubble position (left or right)
  • Custom avatar image
  • Source list under answers (hidden by default)
  • Thumbs-up and thumbs-down (shown by default)
  • New-conversation button (shown by default; clears the chat and shows the greeting again)
  • Rate limits and daily/monthly message caps
  • Allowed embedding domains (leave empty to allow any site)
  • "Powered by DaRetriva" branding (removable on Business plan and above)

Appearance on your site (optional)

Skip this section if the Chatbot tab is enough. These attributes override the dashboard only when you set them, and they can change after the widget is already open.

Avatar, color, and font

<script
  src="https://daretriva.com/widget/loader.js"
  data-token="YOUR_WIDGET_TOKEN"
  data-avatar="https://example.com/avatar.png"
  data-color="#111827"
  data-text-color="#111827"
  data-font="Georgia, serif"
  async
></script>

Follow the site theme

data-theme="auto" is off unless you set it. The widget then follows the operating system, a dark or light class on <html>, and data-theme on <html>.

<script
  src="https://daretriva.com/widget/loader.js"
  data-token="YOUR_WIDGET_TOKEN"
  data-theme="auto"
  async
></script>

Change it while the page is open

setTheme("light") or setTheme("dark") sticks and stops following the site. setAppearance changes only the fields you pass. An already open panel updates in place.

window.DaretrivaWidget?.setTheme(
  document.documentElement.classList.contains('dark') ? 'dark' : 'light'
);

window.DaretrivaWidget?.setAppearance({
  color: '#111827',
  textColor: '#111827',
  font: 'Georgia, serif',
});

Every option

Absent attributes do nothing. The widget keeps the dashboard value or the built-in default.

OptionValuesIf omittedAffects
data-tokenWidget tokenRequiredWhich agent answers
data-langen, fr, de, es, arBrowser languageLanguage of the panel
data-avatarhttps image URLDashboard avatar, then the agent avatarLauncher and header
data-color#RGB or #RRGGBBDashboard brand colorLauncher, header, visitor bubbles, send button
data-on-color#RGB or #RRGGBB#fffText and icon on the brand color
data-text-color#RGB or #RRGGBB#0f2744Assistant text and the input
data-muted-color#RGB or #RRGGBB#3e5168Placeholder, footer, typing indicator
data-background#RGB or #RRGGBB#f3f6fbPanel background
data-fontCSS font-family stackThe widget fontText inside the panel
data-font-urlhttps://fonts.googleapis.com/…NoneStylesheet loaded inside the panel
data-themelight, dark, autolight, site theme ignoredLight or dark palette
data-positionleft or rightrightLauncher side
data-z-indexInteger, 1 to 21474836472147483000Stacking of the launcher and the panel
data-offset0–200 pixels20Distance from the corner
data-show-sourcestrue or falseDashboard, else hiddenSource list under each answer
data-show-feedbacktrue or falseDashboard, else shownThumbs under each answer
data-show-restarttrue or falseDashboard, else shownButton that clears the chat and shows the greeting again
setLanguage(lang)en, fr, de, es, arCurrent languageLanguage, including an open panel
setTheme(mode)light, dark, autolightTheme. light and dark stay put; auto follows the site
setAppearance(patch)avatar, color, onColor, textColor, mutedColor, background, font, fontUrl, theme, position, zIndex, offset, showSources, showFeedback, showRestartOnly fields you pass changeLauncher immediately, and the open panel

Which value wins

Last JavaScript call, then a data attribute, then the dashboard, then the built-in default. data-color replaces the dashboard color only when the attribute is present. The official snippet does not set it. The dashboard bubble side is not applied: the launcher stays on the right unless you set data-position="left".

The panel is an iframe on the DaRetriva domain, so your site CSS and self-hosted fonts do not apply inside it. Use a system font stack in data-font, or load a stylesheet with data-font-url. That URL must be https and hosted on fonts.googleapis.com, and data-font must name the same family.

See it live

This is a real DaRetriva widget, embedded the exact same way described above.