Table of Contents

Open LiveChat bot as soon as page loads (3 ways)

Pau Sanchez Updated by Pau Sanchez

Maybe we want to display the LiveChat as soon as the page is loaded to greet customers, here are three ways to do it:

In Landbot 3

Display bot Always and As Soon As the page is loaded

<script>
myLandbot.onLoad(function() {
myLandbot.open()
})
</script>

Display bot Always and 3 seconds after the page is loaded

<script>
myLandbot.onLoad(function() {
setTimeout(function(){
myLandbot.open()
},3000)
})
</script>

Display bot only to new visitors

<script> 
myLandbot.onLoad(() => {
var visitor = localStorage.getItem('firstvisit')
if (visitor != 'true'){
localStorage.setItem('firstvisit', 'true');
myLandbot.open() } })
</script>

Display bot only to new visitors after 3 seconds

<script> 
myLandbot.onLoad(() => {
var visitor = localStorage.getItem('firstvisit')
if (visitor != 'true'){
localStorage.setItem('firstvisit', 'true');
setTimeout(function(){
myLandbot.open()
},3000) } })
</script>

We will always locate the code right after the one we used to embed our bot

In Landbot 2

Display bot Always and As Soon As the page is loaded

<script> 
myLandbot.on('landbot-load', () => {
myLandbot.open()
})
</script>

Display bot Always and 3 seconds after the page is loaded

<script> 
myLandbot.on('landbot-load', () => {
setTimeout(function(){
myLandbot.open()
},3000)
})
</script>

Display bot only to new visitors and 3 seconds after the page is loaded

<script> 
myLandbot.on('landbot-load', () => {
var visitor = localStorage.getItem('firstvisit')
if (visitor != 'true'){
localStorage.setItem('firstvisit', 'true');
myLandbot.open() } })
</script>

We will always locate the code right after the one we used to embed our bot:

How did we do?

How to launch a Landbot by clicking a button

Contact