Autoload chatbot with delay using JavaScript Web SDK

Autoload is a feature that allows your bot to automatically pop up. Using the Certainly Widget, you can configure Autoload by delay, scroll offset, or a mix of both.

Below, we'll dive into how to do the following:

Read more about the behavior of the Certainly Widget.

Configure Autoload by delay or scroll offset

To enable this feature, first access Bot Settings using the right sidebar menu. In the Channels tab, select the Certainly Widget. Then you can configure Autoload in two ways:

  • Click the Autoload tab below where it says "Default Styling", then adjust the "Time" and "Scroll down" fields as desired, or
  • Edit the Widget script directly, which can be found below the phrase "Embed the Chatbot Widget on your website". Delay is specified in seconds, and ScrollOffset is in pixels.
id: "xx-xx-xx-xx",
autoloadDelay: 56,
autoloadScrollOffset: 700,

When the chatbot pops up, the actual conversation is not started. It will only display the bot avatar and greeting message until the user clicks the text field.

Configure Autoload with events other than delay or scroll offset

If you would like to have the chatbot pop up after events other than delay or scroll offset, it is possible to do it using Conversational Web SDK.

For example, the chatbot window could be configured to pop up after the end user visited N pages in M minutes, or after the end user visited N pages within a particular category of products. It is also possible to begin the conversation session automatically, so end users don't need to click on the input line to start it.

The example below uses setTimeout() Javascript function to autoload the chatbot and start a conversation:

id: "xx-xx-xx-xx",
webchatKey: 1
}, function () {
//Make sure that the chatbot window is closed at the beginning 
certainly.widgetStatus({action: "close", webchatKey: 1});
setTimeout(function () {
certainly.widgetStatus({action: "open", webchatKey: 1});
}, 120000); //Here you set the number of milliseconds (sec*1000) after which you want the chat window to pop up and start the conversation

Here, you would need to replace id and webchatKey with your values, as well as specify the number of milliseconds (sec*1000) after which you want the chat window to pop up and start the conversation.

Find the id of the bot in Bot Settings in the Channels tab, under the Certainly Widget section.

The webchatKey is a unique Identifier of the webchat widget. This is needed in case you have several widgets on your site. Once it is passed to initCertainlyWidget(), it must also be passed to all other Certainly methods.