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.
| Option | Values | If omitted | Affects |
|---|---|---|---|
| data-token | Widget token | Required | Which agent answers |
| data-lang | en, fr, de, es, ar | Browser language | Language of the panel |
| data-avatar | https image URL | Dashboard avatar, then the agent avatar | Launcher and header |
| data-color | #RGB or #RRGGBB | Dashboard brand color | Launcher, header, visitor bubbles, send button |
| data-on-color | #RGB or #RRGGBB | #fff | Text and icon on the brand color |
| data-text-color | #RGB or #RRGGBB | #0f2744 | Assistant text and the input |
| data-muted-color | #RGB or #RRGGBB | #3e5168 | Placeholder, footer, typing indicator |
| data-background | #RGB or #RRGGBB | #f3f6fb | Panel background |
| data-font | CSS font-family stack | The widget font | Text inside the panel |
| data-font-url | https://fonts.googleapis.com/… | None | Stylesheet loaded inside the panel |
| data-theme | light, dark, auto | light, site theme ignored | Light or dark palette |
| data-position | left or right | right | Launcher side |
| data-z-index | Integer, 1 to 2147483647 | 2147483000 | Stacking of the launcher and the panel |
| data-offset | 0–200 pixels | 20 | Distance from the corner |
| data-show-sources | true or false | Dashboard, else hidden | Source list under each answer |
| data-show-feedback | true or false | Dashboard, else shown | Thumbs under each answer |
| data-show-restart | true or false | Dashboard, else shown | Button that clears the chat and shows the greeting again |
| setLanguage(lang) | en, fr, de, es, ar | Current language | Language, including an open panel |
| setTheme(mode) | light, dark, auto | light | Theme. 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, showRestart | Only fields you pass change | Launcher 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.