All Collections
Chat
Initiate webchat upon website event
Initiate webchat upon website event
Hadas Rahamim avatar
Written by Hadas Rahamim
Updated over a week ago

Ever wanted to use different chatbots to different target audiences with your webchat?

Now you can :)

You'll need to invoke it based on your condition - visitor clicked on a button, originated from a certain state, or has a specific UTM Source.

Here's an example:

The chat appears only when clicking on the button.

So how do I do that?

You will have to copy the code below as a script and invoke the onClickButton() whenever you want the chat to appear. Don't forget to replace the <sequence ID> below with your chat's sequence ID.

function onClickButton() {
setDocumentCookie("triggerExceedChat_<sequence ID>", "true", 1);
}
function setDocumentCookie(cname, cvalue, exdays) {
var d = new Date();
d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
var expires = "expires=" + d.toUTCString();
document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
}


Did this answer your question?