Table of Contents

How to not display Proactive Message to repeating Visitors

Pau Sanchez Updated by Pau Sanchez

Here is the code you need to use in the page where you added the code to display the bot, to stop displaying the Proactive message to repeating visitors

Landbot 3

In the Design > Custom Code > Add JS section, add the following code:

var landbotScope = this;
let proactiveShown = window.localStorage.getItem('proactiveShown')
if (proactiveShown == 'true'){
let ruleCSS = `.LivechatProactive{display:none !important}`
} else {
window.localStorage.setItem('proactiveShown', 'true')

Landbot 2

If you want to avoid spamming repeating visitors to your site with the same proactive message, all you need to do is swapping the below default code in the Share / Embed section...

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

...with this new one:

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

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

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?