Table of Contents

How to redirect visitors to another URL in the same tab (embedded landbot)

Rafaela Basso Updated by Rafaela Basso

In Landbot v3

In our builder flow we add a Code Block after a button like in the picture below:

window.location.href = 'https://www.landbot.io'

In this case we are redirecting the user to https://www.landbot.io

But you can change the site to be redirected to.

In case you want to use a variable value, here is how you should add the variable, in this example we use the variable @variable_url:

window.location.href = "@{variable_url}"

In Landbot v2 (Legacy)

If you want to see how it works, click on the widget in the bottom right of your screen ;)

In case we need to redirect users but keeping them in the same window (tab), the process is as follows:

This tutorial is directed to bots embedded into your website. If you want to see how to do this for bots not embedded, check out this article.
  1. In our builder flow we add a Code Block after a button like in the picture below:

With the following code:

Landbot.send('sendto','https://www.landbot.io')

Change the url according to your needs.

  1. In the site where the bot is embedded, you need to add the following code (it will trigger the redirection):

myLandbot.on('sendto',(data) => {
window.location.href = data;
})

You need to add the code right below the embed code, as you can see in the following picture:

How did we do?

How to limit dates to pick up to 90 days in advance

How to POST, GET (and more) with Landbot

Contact