Categories

Categories

Hide welcome message for repeating visitors

Hide welcome message for repeating visitors

The first question in the chatbot can be set as the welcome message of the chatbot. This is used to catch the attention of the user and make the chatbot more interactive.
notion image
 
However, if you don't want repeating visitors to see the same welcome message again, you can do so, by adding a piece of code snippet.

Additional code

<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/js-cookie/2.2.1/js.cookie.min.js"></script>
<script> var collectchat = window.collectchat || {};
 collectchat.ready = function() {
    if(Cookies.get('collect_chat_closed')) {
       collectchat.config({
          welcomeMessage: -1
       });
    }
 }
</script>
 
The above code, reads the cookie, "collect_chat_closed" and if it is set, then turns off welcome message by changing the config settings.
You just need to make sure that the code snippet is added at the same place, where you have added the code snippet of the chatbot.


Still need help?

Contact us