Sometimes referencing an answer chosen earlier isn't enough. You may want to cluster respondents by many conditions — how they answered different questions, their demographics, and more. You can declare and alter variables throughout the survey, then adjust logic accordingly.
Quiz Score
If your survey is a quiz, you can increase or decrease a running score for each respondent as they answer questions. The value is kept individually per respondent and can be referenced to show results or alter the survey experience.
💡 Tip: You can use any alphanumeric variable name (A–Z, a–z, 0–9, underscore). "QuizScore" is just an example.
[QuizScore = 0]— initializes the variable with the value 0[QuizScore + 1]— adds 1 to the current value[QuizScore - 5]— subtracts 5 from the current value[QuizScore]— displays the current score to the respondent
💡 Tip: Use
[QuizScore]in a test field while programming to verify the value is updating as expected, then remove it before launching if you don't want respondents to see it.
NPS
Create a variable and assign respondents a text value based on their answers — then append to it later if needed.
[NPS = "Promoter"]— initializes the variable with the text value "Promoter"[NPS + "and Influencer"]— appends to the variable, resulting in "Promoter and Influencer"
Variables can store either text or numbers for use throughout the survey logic.
Creating Custom Variables
aytm Logic doesn't require you to declare variables before using them — the type (text or number) is determined when you first use the variable. By default, each variable stores an empty value "".
Variable naming rules:
- Allowed characters: A–Z, a–z, 0–9, and underscore
_ - Must begin with a letter
- String values must be surrounded by quotes and may contain any character
- Cannot start with
Q#orPQ#(followed by a number) — reserved for direct references - Cannot use reserved names:
aytm_response_id,uuid,var1,var2,var3,device,browser,vr_collected,gender,income,education_level,age,children,relationship_status,ethnicity,employment,career,show,hide,group,if,not,max,or,and,exclude,exit,region,country,state,county,zip
Reserved Variables
Use a reserved variable name in square brackets to pipe in respondent data. Available reserved variables: uuid, var1, var2, var3, device, browser, gender, income, education_level, age, children, relationship_status, ethnicity, employment, career, region, country, state, county, zip.
For example: "We've noticed that you're using [device] to take this survey. Is this correct?" — a respondent on an iPhone will see: "We've noticed that you're using mobile to take this survey. Is this correct?"
var1, var2, and var3 can be mapped to custom variables passed through the URL when using list surveys.
⚠️ Note: Variables are initialized and updated when a respondent exits a question. You can't rely on a variable manipulation within a question until the respondent has made their choice and moved to the next one.