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.


How did we do?

Prevent Landbot from loading in mobile browsers

Display Bot During Business Hours Only (Livechat & Popup)