Skip to content

Survey variables

Survey variables insert participant details, sample information, project fields, and earlier answers into survey content. Write a variable inside double braces, such as {{sample_code}}.

Use variables in question text, Page Text, and survey redirect URLs. Values depend on the current participant and serving. Participant details may be unavailable before sign-in; sample values are available while evaluating a sample.

Add this text to a sample questionnaire:

Please taste sample {{sample_code}} before answering.

For a sample presented as 321, participants see “Please taste sample 321 before answering.” Use the blinding code in participant instructions when the sample’s name would reveal its identity.

Variable Value
{{participant_id}} RedJade’s numeric participant ID
{{participant_external_id}} ID supplied by your application or panel provider
{{participant_code}} RedJade participant code
{{participant_name}} Participant name
{{participant_email}} Participant email address
{{participant_note}} Note stored on the participant
{{participant_verification}} Assigned block-row verification code
{{participant_locale}} Participant locale, such as en_US
{{day}} Current survey day; defaults to 1
{{position}} Current serving position; defaults to 1
Variable Value
{{sample_code}} Code used for the current sample presentation
{{sample_name}} Sample name
{{sample_description}} Sample description
{{sample_image}} HTML image markup, ready to display in survey content
{{sample_image_url}} Image path for use in an image element; it may be relative to the survey host
{{sample_SHORT_NAME}} A custom sample field, using that field’s short name

For example, a sample field with short name storage_temperature is available as {{sample_storage_temperature}}:

Serve sample {{sample_code}} at {{sample_storage_temperature}}.

For a serving with multiple samples, text values are joined with commas and sample_image contains the images together. Indexed forms such as {{sample_name[123]}} select one serving sample. The bracketed number is its RedJade serving-sample ID, not its blinding code or its position in the list.

Variable Value
{{project_name}} Project name
{{project_description}} Project description
{{project_SHORT_NAME}} A custom project field, using that field’s short name

A project field with short name study_reference becomes {{project_study_reference}}. Custom sample and project fields need a short name and must be active. Use the variable shown in the editor for your field.

Open Answer Piping Variables in the questionnaire builder and copy the variable for the question or grid row. These names are generated from the question or row identifier:

Pattern Value
{{question_IDENTIFIER}} Answer to a question that supports piping
{{group_IDENTIFIER}} Answer to a supported grid row

Place the copied variable in a later question or Page Text. For example, if the editor gives you {{question_a1b2c3}} for a flavor question:

You selected {{question_a1b2c3}}. What did you like about it?

Choice questions generally pipe the selected labels; multiple selections are joined with commas. Text and numeric questions pipe the entered value. The exact representation depends on the question type. Copy the generated variable rather than using the question’s display number or an API question key.

A provider can send external_id=panel-member-17 on the survey entry URL. Use the matching variable in its return URL:

https://panel.example/complete?respondent={{participant_external_id}}

For that participant, the destination is https://panel.example/complete?respondent=panel-member-17. See third-party panels for configuring outcome redirects.

Replacement inserts the value as supplied; it does not URL-encode it. This example uses an ID containing only URL-safe characters. Values containing spaces, &, #, or other reserved characters need encoding before being placed in a URL.

This Page Text script sends the RedJade participant ID with a tracking event. The ID is numeric; the check prevents an unresolved variable from being sent as an ID:

<script>
(() => {
const participantId = "{{participant_id}}";
if (!/^\d+$/.test(participantId)) return;
navigator.sendBeacon(
"https://tracking.example/events",
new URLSearchParams({
event: "external-task-viewed",
participant_id: participantId
})
);
})();
</script>

Replace the endpoint with your own tracking service. This example relies on a numeric ID. Variable replacement does not escape JavaScript strings or HTML, so do not interpolate free-text answers, names, or other arbitrary text into executable code. See custom JavaScript for script placement and testing.

Participant Start instructions also support these variables, based on the configured identity challenge:

Variable Value
{{challenge}} Full entry label, including a secondary identifier when configured
{{strategy}} Primary identifier label, such as email or code
{{secondary}} Secondary identifier label, when configured

For example, Enter your {{challenge}} to begin. uses the sign-in screen’s configured label. These variables describe the entry controls; they are not participant identifiers.

Use the Test Previewer with the relevant participant and sample to check substitutions. An unknown variable or one without a value can remain visible as {{variable_name}}. Answer-piping variables are blank before the question has an answer.

Check the final text, URL, and tracking request in a participant session. Missing values must not become literal identifiers in an external system. The Test Previewer does not save responses or reproduce a live participant’s resumed session; test returning-participant behavior through the survey entry URL.