How to not display Proactive Message to repeating Visitors

This article corresponds to the V2 (Classic) of the app. You can check the equivalent for the new version V3 (Bricks) here

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.

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

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 //
</script>

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?