How to redirect visitors to another url (Landbot fullpage) (v3)

There are moments when we want to redirect visitors to another url in our website, maybe to let them find out a help article or a product that we want to recommend.

To do so, we can set up a trigger function that at some point of the conversation can redirect users to a new url in the same tab. We have two options:

  • redirect to a fixed url;
  • redirect to a variable url;

Redirect visitor to a fixed url

  1. In the moment of the flow where we want to redirect the user, we will add the following code:

Redirecting<script>changeUrl()</script>

  1. In the Design / Advanced / Add JS section, add the following code:

Here you just need to change the url according to your needs

<script>function changeUrl(){
window.location.href = "https://www.landbot.io"
}</script>

Redirect visitor to a variable url

This way is useful for example if you are offering a custom solution for visitor depending on the flow.

  1. First we are going to set up a variable with the value of the url where we want to redirect the users

Do not use "url" as the name of this variable
  1. Similar to the first example, in the moment where we want to redirect the visitor we are going to add the following code to trigger the change to the specific url we defined earlier

  1. In the Design / Advanced / Add JS section we will add the function that will make the redirection based on the url we defined earlier.


How did we do?