Skip to main content

Variables

A variable is a named value that changes from one participant to the next. You put its name into a question, a page title or a message, and each participant sees their own value in its place. You can also test one in a logic rule, which is how a campaign branches on something other than an answer.

The three kinds​

Custom variables are yours. You give one a name and, if you want, a starting value, and the campaign can change it as the participant goes.

Answer variables are filled from an earlier answer. They exist so that something a participant typed on page one can be repeated back to them on page four, and they are created by the rule that fills them rather than by hand.

System variables are built in and read only. Mambo fills them in as the session runs.

Using a variable​

Write a variable into any wording a participant sees: a question, its description, a page heading, a message on an ending. Typing $ while you write brings up the list to pick from, which is quicker than remembering names.

The same variables are available in the condition of a logic rule, so you can send somebody down a different route based on their score, their name or the date.

System variables​

Ten variables are always available.

VariableHolds
Quiz scoreThe participant's total score so far.
Quiz feedback messageThe message for the score range they landed in.
Quiz range start, Quiz range endThe bounds of that range.
Participant UUIDTheir unique ID.
First name, Last name, EmailTheir profile details.
Date, TimeWhen the campaign is being answered.

Two things to know about when these have values.

Date and time always work. They are worked out at the moment they are read, in your site's timezone.

The participant variables need the participant to be known. If your integration says who is starting the session, they are filled from the start and can be used anywhere. If the session starts anonymously, nobody is identified until the end, so those variables are empty for the whole campaign and only have values on the ending. A rule on page two testing an email address will not match, because at that point there is no email address. See Identifying participants.

The quiz variables fill as the quiz is scored. The score builds as answers are submitted, and the feedback message and its range are only known on an ending, once the campaign works out which band the final score falls in. See Quizzes.

Setting a value​

Three places can give a variable a value, and the first of them that has one wins.

  1. What your integration sends when it starts the session. This is how a campaign is told something it could not have asked, like which page of your site the participant came from.
  2. A distribution override, which replaces the campaign value for everyone coming through that distribution. See Distributions.
  3. The campaign value, which is the default for everyone else.

A distribution override has to name a variable the campaign already defines. You cannot invent one for a single distribution.

During a session, rules can change a variable as well: setting it to a value, saving an answer into it, or transforming it arithmetically. See Logic.

Naming​

Names must be unique within the campaign, and cannot start with mambo., which is reserved for system variables.

A name cannot be changed after the variable is created. Everywhere that refers to a variable refers to it by name, so renaming one would quietly break every rule and every piece of wording that used it. If you need a different name, make a new variable and delete the old one.

Deleting​

Deleting a variable does not delete what used it.

Rules that tested it stop matching, because there is nothing left to test. Wording that referred to it shows the reference itself rather than a value, which participants will see. The editor tells you how many rules and how many pieces of wording are affected before you confirm, and it is worth reading that count rather than clicking through it.