How to redirect visitors to another url (Landbot url / not embedded)
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
- In the moment of the flow where we want to redirect the user, we will add the following code:
- In the Design / Advanced / Add JS section, add the following code:
Here you just need to change the url according to your needs
window.location.href = "https://www.landbot.io"
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.
- First we are going to set up a variable with the value of the url where we want to redirect the users
- 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
- In the Design / Advanced / Add JS section we will add the function that will make the redirection based on the url we defined earlier.