Add the snippet
- Open Widgets, select your widget, and stay on the Setup tab.
- Under Installation, copy the Embed snippet. Your widget ID, config token, and Appearance settings are already in it.
- Paste it before the closing
</body>tag on every page that should show the widget.
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.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 thedata-display-mode attribute:
Hiding the launcher button
Hide the default launcher button withdata-hide-button:
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, callDecimal.theme().