conditional-logic-bot

With the growing amount of content competing for consumer attention, many brands turned to hyper-personalization to keep their messages captivating and relevant to audiences.

Before the “no-code” revolution, trying to hyper-personalize both the campaigns and content was exclusive to large companies with the resources to gather big data and develop complex customer journeys.

Those days are over.

Online apps like Landbot helped to hammer the last nail into the coffin of technological exclusivity of resource-rich corporations.

For those who aren’t familiar with Landbot yet, you are about to have your mind blown with beauty, sophistication, and simplicity… OK, maybe I crossed the line a little 😂… But really, Landbot is one of those magic no-code tools. In particular, it allows you to build conversational forms and chatbots without dropping a single line of code.

We’ve previously shown that with a few drags and drops you can create and embed a simple bot in half an hour. The article is helpful but might be misleading. To be clear, just because something is simple to use doesn’t mean it can only do simple things.

One of the easiest ways to create hyper-personalized experiences for each person chatting with your bot is through the use of conditional logic and variables. Still, a lot of no-coders are afraid to touch them… or perhaps fail to see the advantages.

Hence, we’ve decided to put together a “little” guide to creating a hyper-personalized conditional logic bot.

In Landbot, there are 3 key ways you can condition conversations:

  1. Based on Real-time Inputs
  2. Using URL Variables
  3. Against 3rd-party Database

Better yet, each of these approaches can be translated into numerous use cases.

Let’s have a look at how it’s done with Landbot builder as well as how the mechanics can be leveraged in practice!


The Anatomy of the Conditional Block


Before we get down to business and see practical examples and use cases, let’s get to know the Conditional Block a little better!

To open a conditional block, all you need to do is draw an arrow from the block after which you wish to apply it and search for “CONDITIONS.”

A new block marked with a little traffic light emoji will appear in your flow. (That’s exactly how you should think about that block – as an intersection -🚦👀)

You will be able to set up and manage the conditions in the sidebar that pops out on the left:

Learn how to apply conditional logic to your dialogue flow.

  • First field – IF @ – is the place to input the variable you want to condition (e.g. @email or @age)
  • Second field opens a drop-down menu of the available conditions.
  • Third field is where you type a value or another variable you want to check against the first variable.

And, the conditions you can apply to your dialogue flow include:

  • Equals to
  • Does not equal to
  • Contains
  • Greater than
  • Less than
  • Is set

conditional-logic-block

The actual block has two exits of a different color. The GREEN represents the exit if the condition was TRUE, the PINK represents the exit if the condition turned out to be FALSE.

Let’s have a look at how can we apply conditions in real marketing situations to improve the level of personalization in customer experience.


1. Conditional Logic based on Real-Time Answers


The first and most straightforward type of conditioning I want to talk about is behavioral and real-time conditioning based on users answers and choices in the course of the conversation with your bot.

In this case, the conditioning isn’t dependent on any outside sources or databases but unravels solely according to user responses.

Lead Generation


Imagine a traditional lead generation bot that helps you collect information on your prospects such as their contact info, industry, company size, their role and so forth.

hyper-personalized-lead-generation

To apply conditional logic and adjust the flow based on the answers, you first need to ensure that each answer is being saved under a distinct variable.

To do so, click on the “settings” icon of one of the buttons:

assign-variables-lead-gen

And rename the variable for that question:

Once done, draw an arrow from the last block to create your condition block.

In this example, we will try to single out the highest quality lead based on their profile.

For instance, we know that our ideal and most profitable customers work in industry B, have 11-50 employees and have an Owner C-level role. So our condition will look as follows:

But what happens when your ideal lead can be both an owner or c-level executive?

You can create a chain of conditions introducing the “OR” factor instead of “AND” which allows you to accept more than one type of response as “TRUE.”

applying-condtional-logic-to-dialogue-flow

At each step, if the condition is not fulfilled, you can redirect the users back to the original flow or even create a separate flow for each instance.

In this example, the ideal lead journey looks as follows:

IF @industry = B then TRUE ➡️ IF @companysize = 1-10 OR 11-50 then TRUE ➡️

IF @role = Owner OR C-level then TRUE ➡️ … once you have separated the ideal leads, you can:

  • proceed to ask more specific questions
  • provide more relevant information
  • facilitate an immediate human takeover to tie the lead down while it’s hot
  • Schedule a call or meeting

Or, you may decide to condition it further!

For example, ideally, you would want this lead to be transferred to a salesperson. However, for most of us, it’s possible to have agents available 24/7. Hence, you can also condition the human takeover based on the availability of your agents:

hyper-personalized CX human takeover

When agents are available, your bot will initiate a human takeover.

On the other hand, when everyone assigned to this bot is offline, the bot can offer to schedule a call instead.

conditioning-human-takover-based-on-agent-availablility

A conditional logic bot can help you not only generate leads but pre-qualify them using real-time data instead of leaving your prospects to fill out the form and wait until you have time to sort through all of them. Think of it as a more sophisticated version of dynamic forms.

Hyper-Personalized Marketing through Conversations


Not every brand has the luxury of having a very specific audience. While usually there are factors narrowing down your scope, more often than not marketers must find ways to communicate with a set of audiences varying in age, interests, and behaviors.

Being able to deliver relatable experiences has become particularly important since the value of experience climbed up the ladder surpassing even price. Consumers are craving more personal and less salesy relationships. So, besides buying your product, they expect to connect with your company values, mission, narrative…

While chatbots in general already allow you to engage users in a two-way interaction instead of keeping them silent as passive spectators, they can help you take things a step further.

Employing conditional logic is not just useful when filtering data but can be the ultimate tool for applying psychology into your marketing strategy. In other words, conditioning doesn’t necessarily mean you will provide customers with completely different content. All it takes is adjusting the tone of voice, personalizing pop-culture references, using specific expressions, etc.

For instance, in the most simplistic scenarios, you can diverge separate routes based on gender and age:

hyper-personalized-marketing-bot

That’s just the tip of the iceberg though. Based on the key factor defining your audiences you can personalize the chat on conditions such as:

  • marital/relationship status
  • student/professional status
  • neighborhood/city/state of residence
  • interests
  • education
  • etc.

In this manner, the chat starts off on a fairly neutral note but personalizes as the prospect progresses through the dialog flow. With a single chat, you are able to connect with diverse groups of people through using pivotal data points such as the language/slang they use, using cultural references they recognize and experiences they relate to.

Imagine running a single marketing campaign on social media using a single bot that does the personalization for you in real-time!

Conditional Logic for Quizzes


On a less serious note, conditional logic is a fast and easy way to build quizzes. If you are looking to engage your audience, a conditional logic bot might just be the answer.

How do create a quiz using conditional logic?

Well, we will need to use conditional logic AND values. As well as one of Landbot’s best features – Bricks!

Once in the builder, drag an arrow and, instead of asking a question create a brick.

You will create one for every single question.

Why?

chatbot-quiz-using-variables-and-conditions

Well, there’s a whole lot going on inside. Let’s check out the anatomy of question 1:

Each brick needs a starting message block. We used a simple “Let’s Start!”

question-brick-landbot

Before you ask your first question, you need to set up variables and assign them a numeric value which will allow you to count the points.

In this example “Which HP character are you?” we set up 3 variables based on the 3 possible results:

  • harry_points
  • hermione_points
  • ron_points

Each of these variables was assigned a numeric format and initial value 0 (you won’t need to repeat this step in the next question bricks as the variables only need to be set up once):

set-variables-and-assign-value

Only then it’s time to ask the first question.

However, before continuing, you need to set up a variable block for each answer inside which you will perform a calculation. According to the image below, you need to do the following:

calculate-variable-value-for-hyper-personalization

  • Select appropriate variable
  • Activate “Perform a calculation?”
  • Enter start value (e.g. @harry_points for an answer that points to Harry)
  • Select the desired operation ( in our case +)
  • Enter the value you want to add to the variable in the “End Value” field.

After the calculation, whichever answer user selected, the variable corresponding to that answer will grow by one point with each answer.

calculating-quiz-results-using-variables

The next question brick will look the same (except you don’t need to repeat the set up of the variables before the question anymore only the calculation that comes after):

chatbot-conditions-and-variables

So, where is the conditional logic?

It comes into play at the end, when it’s time to calculate the final result!

condtional-logic-in-chatbot-quiz

It’s simple…

IF @harry_points IS GREATER THAN @hermione_points

AND

IF @harry_points IS GREATER THAN @ron_points

THEN

Result: “You are Harry!”

Condition each of the results the same way and you are set!

Plus making a much longer quiz is really not an issue since you can simply copy the question bricks and change the contents without having the build the structure again.

See?

A conditional logic bot is not doesn’t have to be all work and no play!


2. Conditional Logic based on URL Variables


The other type of conditional logic you can take advantage of is basing your conditioning on browser variables such as the URL.

For example, your website URL may differ slightly according to the state or the country where the user accesses it. Or, it can contain language variables (.com/es) to display your website in different languages.

Landbot application allows you to condition your chatbot based on your URL.

Let’s have a look at how to go about it.

For example, let’s say your business operates in the USA, Canada, and Australia. In each country, the extent of your offering and support is slightly different so you use users API to see where the leads are coming from and loading a country-specific landing page.

Your bot can do the same.

Since we are not working with required fields of real-time data as in the first case, it’s crucial your bot knows what to do if the conditional data is not available. This may happen, for instance, if the user is using an incognito mode.

So, the first condition you need to design is:

IF @language IS SET (meaning if the language data exists) THEN…

conditional-logic-url-variables

This step ensures that in case the language variable is not available, your bot doesn’t freeze.

For example, if the info is not available from browser data, you can prompt the bot to ask the information or go for the default language.

Next, you need to create a chain of conditions that checks against the variable inside the URL.

It will look much like this:

condtional-logic-bot-url-language

The catch here is that you won’t be able to check this conditional sequence in the usual bot PREVIEW window because it’s based on the URL. To see if it’s working you need to:

  • Save your bot
  • Go to “Settings”
  • Click “Hidden Fields”
  • Select the variable you want to add to your URL
  • Click “APPLY CHANGES”

set-hidden-fields-for-hyper-personalization

  • Got to “Share” options in the header menu
  • Click “Share”
  • Open the URL link of your bot

test-conditions-with-url

A basic URL of your bot will open:

bot-URL

To test if your conditional setup works, you need to add the sequence indicated in Settings – Hidden Fields:  ?variable=XY

In our sample case, this translates to:

test-condtions-bot-url

Then, reload the page and test.

NOTE: Make sure to test the various URLs in an incognito browser window as cookies may interfere with the test.

French:

Spanish:

Those planning to embed the bot on your website and not use it as a landing page, make sure the hidden variable appears in the above format in the website URL, not the bot URL.

Other instances in which you can benefit from conditioning your bot based on the URL are email campaigns.

For example, you already have substantial information about your audience on MailChimp such as name and country or business. You can leverage this information by conditioning the customer-specific MailChimp URL. Imagine you click on the CTA within an email and, when the page pops up, a friendly bot kicks off the conversation with “Hi, Nick! How have you been?


3. Conditional Logic based on Data Check


The third option to condition your chatbot conversation is to condition the flow against information in a database.

This comes in particularly handy if you want to make online forms as frictionless as possible or avoid asking the same information from the same user twice.

Integrate Landbot with Outside Service


One of the ways you can simplify your chatbot is to integrate Landbot with a 3rd-party app or database using Zapier or a Webhook.

For example, in the sample below, we used Clearbit Enrichment solution to check visitors email address. This solution searches for and identifies additional data connected to the input email address such as:

  • full name
  • name of the company
  • size of the company
  • annual revenue
  • URL
  • position the person holds the company,

So, instead of asking ten questions, the bot can jump straight to the information that is missing and make it personal right off the bat:

API-intergration-conditional-logic-for-dynamic-personalized-forms

In the scenario above, we conditioned that (after running the email address through ClearBit integration block) IF @name IS SET and IF @company_name IS SET then skip these questions and progress to the point:

Condition Flow Against Google Sheet


To check information against a database doesn’t always involve working with fancy solutions. Sometimes, all you need is to verify information in the spreadsheet.

Let’s say you want to verify (or allow customers to verify) if a discount code is valid.

  • Ask the customer to provide you with a discount code (text-based question block)
  • Assign the answer a @variable (in this case @discount)

conditional-logic-googlesheets

NOTE: Create the spreadsheet, the sheet and named columns before you proceed with the next steps!

Our spreadsheet looks something like this:

conditioning-bot-flow-based-on-google-sheet-data

  • Draw an arrow and create “GoogleSheets” block
  • If you haven’t connected to your Google Drive account yet, click “Add Account”
  • Select the email address of your Google Drive account
  • Choose the spreadsheet you want to check
  • Select the Sheet within the spreadsheet you want to check
  • Set the action to “GET DATA FROM THE SHEET”

google-sheet-integration-conditional-logic-bot

  • In the upper part of the “REFERENCE COLUMN” select the column of the spreadsheet you want to search – based on the names that are in the first row of the spreadsheet) – (Discount Code)
  • Then, in the lower part of the “REFERENCE COLUMN” add the variable you want to search for (@discount)
  • In the upper part of “GET ROW VALUES” select the name of the column from which you want to extract the data from the row that corresponds to the data found in the original reference column (in our case that column is “Status”)
  • In the lower part of “GET ROW VALUES” select (or create if needed) the variable, you want to retrieve.
  • Click SAVE

Now we are ready to set up conditional logic!

In essence, this will take place:

IF @discount IS SET then retrieve @discount_status

AND

IF @discount_status EQUALS TO “valid” then TRUE (Your voucher is Valid)

conditions-for-hyper-personalized-customer-experience

As you can see in the screenshot, GoogleSheet block also gives you TRUE and FALSE outputs which come in handy when you are retrieving information. So, if a user inserts a code that is not on the list, the flow will go down the FALSE branch and say the code doesn’t exist.

Let’s take a peek at the preview!

CODE VALID:

CODE USED:

CODE DOESN’T EXIST:

So there you have it! This is how to use Google Sheets & conditional logic to your advantage. Though there are many more use cases in which you can apply this combo such as:

  • gaining additional customer data (e.g. we have the email but do we have a phone number?)
  • checking the availability of products, services, and experiences…
  • creating hyper-personalized experiences for returning users whose info you already collected
  • and even making new suggestions based on purchase history (given you store such info in a spreadsheet).

To Sum It All Up…

Well, here you have it. All the different ways you can leverage conditional logic to make your bots unique and conversations more relatable. Keeping things personal while not cutting back on automation is a considerable advantage in an era when consumers crave intimacy and meaningful connections.

It will certainly make the life of your marketing team significantly easier!

Go and give it a try!

Related Post