Hidden Fields (Get params from url and use it as variables)

👉 Did you know that you can hyper-personalize the user experience of your bots with the Hidden Fields?

For example, if you already have the user's name saved as a variable in a bot, you don't need to ask for it again! 🤓

You can also "keep them in the shadow" to nurture your users' information.

If you want to learn more about Landbot's variables, you should read this article, then check the Set variable article!

Get params from url and use it as variables

Wondering what are the Hidden Fields? Let's start from the beginning!

A URL can be used to pass information with a click.

Any word after the question mark "?" in a URL is considered to be a parameter which can hold values.

The value for the corresponding parameter is given after the symbol "equals" (=).

Multiple parameters can be passed through the URL by separating them with "&".
Hidden Fields functionality only works with lower case. If the parameter in the URL has Capital Letters, it won't be recognised

With Landbot's Hidden Fields, you can send variables (parameters) through the URL of the bot.

Let's see how to configure them in 3 easy steps!

  1. First, go to the Builder and select the bot Settings, then select Hidden fields on the left menu:

  1. Now, add the variables you want to send using the URL by typing their name and pressing enter, then click on Apply Changes.
    Keep in mind that you need to use the same field names as in the URL so Landbot can match them:

  1. Add the variables to your URL. For example, if you want to use "email" and "name" as hidden fields, you need to add this:

    ?name=john&email=john@gmail.com

    And your landbot's URL should look like this:
    https://landbot.io/u/H-44687-K4QC4P5YEH0KALZ/index.html?name=john&email=john@gmail.com

 If you're using apps like MailChimp or Intercom, you can add dynamic fields to a URL so you can bulk send personalized URLs. 
Please bear in mind that for the system to accept the numbers 0 and 1, they need to be passed as decimals, like 1.0 or 0.0

Example:
?people=1.0&events=10&fines=0.0

Restricted keywords

These are keywords you are not allowed to use as a hidden fields (parameters) in the url:

  • location
  • welcome
  • message

The use of these words might generate an error like below:

Passing javascript variables from the Container Site to the bot

If you have javascript variables in the global scope in the container site, ready before the bot is loaded. You can pass variables too, by adding them as a parameters in the index url of the embedding script, and using Hidden Fields to use them in the bot too.

<script src="https://static.landbot.io/landbot-widget/landbot-widget-1.0.0.js"></script>
<script>
var myLandbot = new LandbotLivechat({
index: 'https://landbot.io/u/XXXX/index.html?name='+containerNameVariable+'&email='+containerEmailVariable,
});
</script>

Wordpress has restricted words, like "name", please check the full list here: https://codex.wordpress.org/Reserved_Terms

If used it will generate a 404 error


How did we do?


Powered by HelpDocs

Powered by HelpDocs