Dynamic variables
In the Riddle Creator you can use dynamic variables to personalize / dynamically display any Riddle / form data.
You can do the same when building a Riddle via the API - all title
and description
properties can be personalized with dynamic variables.
Syntax
The following syntax is used to embed dynamic variables into a property:
%riddleVariable
Example:
Welcome back, %name!
riddleVariable
then needs to be replaced with the variable you want to use. Keep reading to learn which variables you can use.
Dynamic Riddle variables
Available variables
Riddle type | Variable | Description |
---|---|---|
All | riddle.id | The unique ID of the Riddle |
All | riddle.title | The title of the Riddle |
All | riddle.image | The image of the Riddle - this will be automatically translated to an image in the email automation / DOI |
Quiz | result.title | The title of the user result |
Quiz | result.description | The description of the user result |
Quiz | score.number | The score of the user as a number |
Quiz | score.percentage | The score of the user as a percentage |
Quiz | score.max | The maximum achievable score the user could have achieved |
Example
You could personalize the result page by using the variables result.title
, score.number
, and score.max
:
{
"result": {
"title": "Your result: %result.title",
"description": "You scored %score.number out of %score.max"
}
}
Dynamic form variables
Added form fields can be used in any following blocks as dynamic variables.
For example, adding a a FormBuilder
with two Name
fields and one Email
field makes the following variables available:
- %name (this will always be the first
Name
field) - %name1
- %name2
- %email (this will always be the first
Email
field) - %email1
Here's how you could integrate the variables into a SingleChoice
quiz question:
{
"title": "What's the capital of Germany, %name1 %name2?",
"type": "SingleChoice",
"items": {
"Berlin": true,
"Lissabon": false,
"Leipzig": false
}
}