Gotcha questions — also known as attention checks or quality control questions — are an effective way to ensure respondents are engaged and to filter out bots or disengaged participants. MX8’s custom_validator
and s.terminate_if()
features make it easy to add both “warn & retry” checks and immediate terminations.
This article gives you ready-to-use examples you can drop straight into your surveys.
Best Practices for Gotchas
Mix overt and covert checks: Use explicit instructions (e.g., "Please select Sushi") and logic-based checks (e.g., contradictory answers).
Don’t overuse: 1–2 overt checks in a 10–15 min survey is usually enough.
Randomize options: Avoid bots keying on fixed positions.
Combine signals: Use multiple checks plus
s.count_validation_errors()
for escalation.
Examples
Overt Instructional Checks (Warn & Retry)
These use custom_validator
to warn the respondent and allow them to try again.
Select — pick a specific option
s.select_question(
"Attention check: To confirm you’re paying attention, please select “Sushi” below.",
options=["Pizza", "Pasta", "Sushi", "Burgers"],
randomize=True,
custom_validator=lambda x: None if x == "Sushi" else "Please select “Sushi” to continue."
)
Numeric — enter a specific number
s.numeric_question(
"For this question only, please type 42.",
min_max=(0, 120),
custom_validator=lambda x: None if x == 42 else "Please enter 42 to continue."
)
Rating — follow an instruction
s.rating_question(
"For quality control, please select the lowest rating here.",
scale=(1,5),
custom_validator=lambda x: None if x == 1 else "Please choose the lowest rating (1)."
)
Text — typed keyword
s.text_question(
"Type the word BLUE to continue.",
validation_instructions=None,
custom_validator=lambda x: None if (x or "").strip().lower() == "blue" else "Please type BLUE."
)
Overt Instructional Checks (Immediate Termination)
These end the survey immediately if failed.
Select — immediate terminate
ans = s.select_question(
"Please select “Sushi” below.",
options=["Pizza", "Pasta", "Sushi", "Burgers"],
randomize=True
)
s.terminate_if(ans != "Sushi", "You don’t qualify for this survey.")
Covert Logic Checks
These detect inconsistent or impossible answers.
Consistency across questions
owns = s.select_question("Do you drink coffee?", options=["Yes", "No"])
fav = s.select_question("Which of these is your favorite?", options=["Espresso", "Latte", "Americano", "Tea"])
s.terminate_if(owns == "No" and fav in {"Espresso", "Latte", "Americano"},
"You don’t qualify for this survey.")
Impossible knowledge
planet = s.select_question(
"Which is closest to the Sun?",
options=["Mercury", "Venus", "Mars", "Earth"],
randomize=True,
custom_validator=lambda x: None if x == "Mercury" else "Please check carefully and try again."
)
Grid / Multi-Item Checks
By default, MX8 grid questions already check for straight-lining and will prompt respondents to review if all answers are identical. You don’t need to implement this manually unless you want to change the behaviour.
Example — adding a custom covert check to a grid
rows = ["Price", "Quality", "Design", "Durability"]
grid = s.grid_rating_question(
"Please rate each aspect 1–5.",
rows=rows, scale=(1,5),
custom_validator=lambda d: None if d.get("Price") != 5 else "Please consider rating Price differently."
)
This example flags a specific condition on one row instead of detecting straight-lining.
Escalating After Multiple Warnings
Terminate if the respondent has failed too many validators.
if s.count_validation_errors() >= 2:
s.terminate("You don’t qualify for this survey.")
Tips for Using Gotchas in MX8
Use
custom_validator
for in-question checks.Use
s.terminate_if()
for immediate terminations.Use
s.count_validation_errors()
to escalate after multiple failed checks.Mix styles for better detection and less respondent fatigue.
Wrap-Up
Gotcha questions are a simple but powerful way to protect data quality. In MX8, you can implement them with just a few lines of code, and by combining overt and covert checks, you’ll catch inattentive or automated respondents without frustrating genuine participants.
If you need help integrating these examples into your survey flow, contact the MX8 support team for guidance.