This example shows one way to load the chat widget with require.js.
<script>
var widgetOptions = {
apiKey: "your-api-key",
snippetId: "your-snipppet-id"
};
requirejs.config({paths:{ 'GlassixWidgetClient': 'https://cdn.glassix.com/clients/widget.1.2.min' }});
require(['GlassixWidgetClient'], function(GlassixWidgetClient) {
window.widgetClient = new GlassixWidgetClient(widgetOptions);
widgetClient.attach();
});
</script>
When using the RequireJS Optimizer, it cannot load network/CDN resources. See how to solve it here.