I'm using SoSci Survey for a study where participants are recruited both via
SONA and through other channels. Only the participants who come via SONA should
be credited and redirected back to SONA at the end.
Project name: Perception of a Digital Avatar in Mental Health Screening
Normal survey link: https://soscisurvey.de/digital-avatar/
SONA survey link: https://soscisurvey.de/digital-avatar/?r=%SURVEY_CODE%
On the second-to-last page of my questionnaire, I use the following PHP code
to redirect SONA participants back to SONA so they receive credit:
if (reference() != '') {
redirect('https://fu-berlin.sona-systems.com/webstudy_credit.aspx?experiment_id=444&credit_token=c0409cb5e08c4e498bec96e770ef8aa3&survey_code=%reference%',
false);
}
However, when I tested this, ALL participants were redirected to SONA at the
end of the survey, which is not right.
This suggests that reference() is returning a non-empty value even when no
SONA reference code was actually passed in the URL, which is why the
condition "reference() != ''" is always evaluating as true.
Could you help me understand why this might be happening, and how to
correctly check whether a participant actually came from SONA before
redirecting them?