Set the flow depending on the url path (for embedded landbots)

Ana Updated by Ana

Only for landbots embedded (not standalone). Do not test in Preview mode

We might want to personalise the experience of the visitor to our site with different "chatbots" depending on the section that user is looking at. For example if the visitor is checking your Contact area you might want to offer them to speak live with an agent, or maybe if they are checking the pricing page, you would like to offer them a promotion or just support to select a plan.

Here are the steps for the implementation in the container site and inside Landbot

  1. In the container site where the bot is embedded we need to add the following code, right after the script to embed the bot.

<script>
myLandbot.onLoad(function() {
myLandbot.setCustomData({pathurl:window.location.pathname})
})
</script>

It will send the path to a Landbot variable, that after the Welcome Message, but to be able to capture it.

  1. Now after the Welcome Message block, add a Conditional Block (or as many as you need) to select the flow according to your needs. As you are creating the variable via Javascript, and you want to use it in the Conditional Block, you need to "create" the variable in the editor too when trying to select it

Here is a sample flow:

How did we do?

Create Dynamic Shopping Cart with JS and CSS

Generate a URL that has variables from user answers

Contact