1 · Pass the Samply IDs into the survey
The reserved r parameter is auto-stored in the built-in REF variable; other custom u_ parameters are captured with a "Device and Transmitted Variables" question on the first page.
- Send the message id as the reserved parameter r (e.g. ?r=%MESSAGE_ID%). SoSci automatically stores r in the built-in REF column — no setup needed.
- To also store the Samply ID and participant code, add a "Device and Transmitted Variables" question on the FIRST page and declare the custom variables to read (their names must start with u, e.g. u_sid, u_code).
- Those values are then written to the dataset and appear in the export.
- Run a test interview and confirm REF (and the u_ columns) hold the transmitted values.
Example start link
https://www.soscisurvey.de/<project>/?r=%MESSAGE_ID%&u_sid=%SAMPLY_ID%&u_code=%PARTICIPANT_CODE%
2 · Register completion
A "PHP code" element placed alone on the final page calling redirect(url, false), which marks the interview FINISHED and redirects.
- Add a final questionnaire page containing ONLY a "PHP code" element (commands after redirect() are ignored).
- Build the redirect with SoSci's %reference% placeholder, which resolves to the stored REF value: redirect('https://samply.uni-konstanz.de/studies/<study-slug>/done/%reference%', false);
- Keep the second argument false so SoSci marks the dataset complete before sending the participant to Samply.
- Test a full interview from a real Samply link and confirm it lands on /studies/<slug>/done/<message-id>.
Example completion redirect
redirect('https://samply.uni-konstanz.de/studies/<study-slug>/done/%reference%', false);
Reserved parameters & gotchas
r is reserved (auto-stored in REF) — that is exactly what we use for the message id, and %reference% reads it back. Custom parameter names must start with u (e.g. u_sid). readGET() only reads on the first page.
Things to watch out for
- If you instead capture the id into your own variable, inject it with PHP instead of %reference%, e.g. redirect('https://samply.uni-konstanz.de/studies/<study-slug>/done/'.value('IV01'), false);
- No SoSci plan/tier restriction applies — redirect() and URL-parameter capture are standard features.
Sources
These steps were verified against the platform's official documentation.