Table of Contents

How to redirect user to another url in your site with Livechat open to continue conversation

Pau Sanchez Updated by Pau Sanchez

There are cases where we want to make a conversation across all our site, and guide the user during the whole experience or maybe point them to the right direction and offer them still some sort of support with our Landbot.

Here we will set up our bot to do 2 things:

1. Reaching a specific step in the flow the user will be redirected to another page in our domain where it has also the bot embedded.

2. Once the new page is loaded, we will also open the chat, so the user can continue the conversation.

Bear in mind that this method can only be applied to Livechat and Pop up type of bots.

  1. Add the Embed snippet in your site, so that can be applied to all pages
  2. In the Settings section, Second Visit, set it as "Always Continue the Conversation"
  3. Now in the builder we need to add a Code Block, where we want to trigger the change:
window.parent.location.href = 'https://www.yoururl.com/?red='

It is very important that the url contains the parameter ?red= ,is what is going to make the difference between open the livechat or not.

  1. Then in the site, we need to add this script below the snippet used to embed the bot for the whole site:
    <script>
    let url = new URL(window.location.href)
    let params = new URLSearchParams(url.search);
    let openLandbot = params.has("red") ? myLandbot.onLoad(function() {myLandbot.open()}) : null;
    </script>

How did we do?

How to Detect Visitors Browser

Contact