Prevent bot from loading immediately

Hi @WendyGoh

Thank you for the reply.

I have tried the code you provided and I am still having a problem.

This is the code in my script file.

$(document).ready(function() {
 console.log('bot test 1');

 if (window.HubSpotConversations) {
 console.log('The api is ready already');
 window.hsConversationsSettings = {
 loadImmediately: false,
 };
 }else {
 window.hsConversationsOnReady = [
 () => {
 console.log('The api is now ready');
 window.hsConversationsSettings = {
 loadImmediately: false,
 };
 },
 ];
 }
});

I have the example running here: https://campaign.bupaglobal.com/test-page

The issues I am seeing are that:

1. The code to prevent the bot from loading inside the “if (window.HubSpotConversations) {” statement, does not work. The bot still shows when we go into that IF statement.

2. The “window.hsConversationsOnReady” deferrer is not always called. (try refreshing a few times and you’ll see that the message I am logging does not always come through)