Skip to main content

Add the snippet

  1. Open Widgets, select your widget, and stay on the Setup tab.
  2. Under Installation, copy the Embed snippet. Your widget ID, config token, and Appearance settings are already in it.
  3. Paste it before the closing </body> tag on every page that should show the widget.
It looks like this:
Copy the snippet again after you change Appearance, Allowed domains, or identity verification. The Setup tab marks it Changed since last copy until you do.

React and Next.js

Load the script once, in your root layout, not per page. The widget follows client-side navigation on its own, so the agent always knows which page the customer is on.
If your snippet has a Decimal.theme() call or data-disable-autoboot, carry those over too.

Content security policy (CSP)

If your site uses a Content Security Policy, add the following directives to allow the widget:
  • script-src: allows the widget script to load.
  • frame-src: allows the widget iframe to load.

Troubleshooting

Data attributes

Configure the widget declaratively by setting attributes on the script tag. Everything except the widget ID is optional.
By default the widget boots automatically once the page loads. Set data-disable-autoboot and call Decimal.boot() when you need to pass a user_token or metadata, once your app knows who the signed-in user is.

Display modes

Control how the widget appears using the data-display-mode attribute:
Sidebar modes show a vertical “Ask AI” tab on the right edge that opens the chat when clicked. The sidebar is resizable by dragging its left edge.

Hiding the launcher button

Hide the default launcher button with data-hide-button:
When the button is hidden, use Decimal.show() and Decimal.hide() to control visibility. Useful for custom trigger buttons or embedding in iframes.

Customization

Colors, size, position, header text, and suggested messages are set on the widget’s Appearance tab, and the snippet carries them. To change them from your own code instead, for a dark mode switch say, call Decimal.theme().