Use the exact origin and workspace slug from Widget setup. The queue below lets application code call SupportDesk while the browser is still downloading the widget. Place the initialization before the embed tag.
<script>
window.SupportDesk ||= function (...args) {
(window.SupportDesk.q ||= []).push(args);
};
</script>
<script async src="https://bettercom.co/embed.js"
data-workspace="YOUR_WORKSPACE_SLUG"></script>Replace YOUR_WORKSPACE_SLUG with your own slug. For a self-hosted installation, use that installation’s HTTPS origin. If inline scripts are restricted by your Content Security Policy, put the queue initializer in an allowed application script that loads first.
Test with the network throttled. Immediately call SupportDesk('show') from a test button, then wait for the script to load. Messenger should open once the queued call runs. In a single-page app, install the script in the shared layout and use update for navigation.