Such attention checks are typically spread throughout scales that you already use in your questionnaire. So, create such an item is probably trivial. Usually, not only one such item is used, but three, for example.
I interpret your question as: How do you check if the attention check was passed?
Given that you expect three of three checks to be answered correctly, and they are "hidden" in questions AB01, BC02, and CD03, the PHP code might look like this:
if (
(value('AB01_04') == 5) &&
(value('BC02_08') == 1) &&
(value('CD03_06') == 5)
) {
put('IV01_01', 1);
} else {
put('IV01_01', 2);
}
This PHP filter code will just store the result into an internal variable by using put()
. You you may as well redirect respondents to either a "complete" oder "quality fail" URL, if working with an external panel. Or you may display a survey code only in the first condition (and an explanation in the other).