How to not display Proactive Message to repeating Visitors

Updated 2 weeks ago by Fran

If you want to avoid spamming repeating visitors to your site, with the same proactive message, just swap the following code, given by Landbot in the Share / Embed section.

// Show a proactive message on landbot load
myLandbotLivechat.on('landbot-load', () => {
myLandbotLivechat.sendProactive("Hello there!");

For this new code:

<script> window.onload = function () { 
var proactiveShown = localStorage.getItem('proactiveShown')
if (proactiveShown != 'true'){
localStorage.setItem('proactiveShown', 'true')
myLandbotLivechat.on('landbot-load', () => { myLandbotLivechat.sendProactive("Hello there!"); }); } }
// ualee_063 //

You will need to change the "Hello there!" message for the one you need.

And now the Proactive Message, will be displayed, just the first time the visitor checks your site. And as long as the visitor doesn't clear the browser storage.

These scripts and how to's are not native functionalities. Landbot won't be able to support, help or guarantee these scripts and how to's. These Workarounds and How to's are for developers, as a learning and example material on how to extend or modify some of the platform limitations.  Due to platform updates, some scripts might stop working in the future.Please, note that in case of Scripts and Workaround the Custom Success Team can deliver limited support.

How did we do?