Variables in Riddle are an easy-to-use, no-code solution to creating dynamic and personalized content. Please check out our blog post for more context on why variables are important to create better content. Variables are automatically created for you in every Riddle, and you can use them in text blocks and form fields as pre-filled values. They require zero coding skills to use and allow for a high level of customization when creating Riddles. Variables are available in all Riddle Plans.

Variable types

There are 3 types of variables you can use in your Riddle:

  1. Block Answers Variables: Variables created from Riddle content. These variables store answers to previous questions and are created automatically as you create new question blocks.
  2. Formfield Variables: Variables created by quiz taker form entries. These variables store data entered by the user when taking the quiz.
  3. Data Layer Variables: Variables created through the Riddle Data Layer. When you set up Data Layer items, these items are turned into variables you can use throughout your quiz.

Variables are created as you add new blocks to your Riddle. When you add a new form block, a new variable for each form field will be auto-generated. Naturally, the variable should only be used in blocks following the block that generated the variable.

For example, if a form field asks for a user’s first name, you can only use that variable to personalize a text block in a following question block after the form block is shown. If you build your Riddle with branching logic, you must remember that certain variables may not even exist in a specific branch.

The same is true for Data Layer variables. The creator tool has no insight into when a Data Layer variable is filled as the data is passed to the variable outside the Riddle iFrame. Please keep that in mind when using Data Layer variables.

How to add a variable

Wherever Riddle allows variables, you will see a (+) symbol in the bottom right corner of the text editor.

add form, block and data layer variables as dynamic content to a Riddle

The selected variable will be entered at the cursor position in the text editor and follow the overall paragraph styling.

Default values

Sometimes variables have no value to display. Either because a user skipped over a form block or because you used one before it could receive any value. To avoid showing holes in your text, enter a default value that will be shown in this case. A good example is using the first name to personalize a quiz. If you made the form field skippable, you might not have a first name to display. Instead, enter the word “there” as a default value so that the user will be greeted with “Hi there,”

use default values with variables to avoid holes in your text

Use cases for variables

Implement these use cases in your quizzes to personalize your Riddle and to optimize your quiz marketing funnel.

Personalization

The easiest way to use variables is to use the value from a form field in a text block. Ask the user for a name at the start of the quiz and then use the name to personalize the following questions. In addition to increasing your question completion rate, it will also help your data collection efforts, as you already collected a name as your first lead data right at the beginning of the quiz. You can follow up with a single email form field at the end. Here is an example of making use of this technique.

Emphasizing previous answers

Using answers selected in previous blocks allows making follow-up questions more dynamic and more relevant without creating complex branching logic. Let’s say you are creating a quiz for your article on popular pasta and sauce combinations, and you want your reader’s opinions on their favorite combination. One way to make the quiz more personal is creating branches for each answer option to the question about their favorite pasta and then show the next question referring to their pasta choice. With variables you can reduce the complexity of this to just 2 blocks without branching. Use their answer option as text block in your follow up question. If they selected Linguini as their favorite pasta, your next question can ask: Which of these sauces do you like best with “Linguini”. Check out the example below and hit replay a few times to play with it.

The example uses the Block Answers Variable to fill in the text. As there is no way to reach this question in the poll without answering the previous question, I am not using a default value for this variable.

answers to questions can be used as variables

Dynamic data from the Riddle Data Layer

For advanced marketing professionals, combining variables and the Riddle Data Layer is a great way to pass data from external sources into the Riddle, use it as dynamic content and then pass it back to your data warehouse along with the Riddle data.

If you already have data from your users, like their shipping address or phone number, you can pass that to the Riddle Data Layer and use it to pre-fill a form. With the data pre-filled, the quiz taker can now submit the form as is or update their details if they got a new phone or moved to a new address. Suppose you also pass a unique identifier like a customer ID to the Data Layer. In that case, you can now update the original data source with the updated user data.

Pro tip: you can test if your Data Layer setup works by displaying data layer values in text blocks. Add a text block as the first block in your Riddle and display all data layer values there. This way you can easily see if Riddle picked up everything you sent to the Data Layer without exporting the Riddle data first.

Feedback and other use cases

If you have other use cases or examples you want to share with us, please send them to hello@riddle.com. Also, don’t hesitate to get in touch with us if you need help using variables in your Riddle projects.