Configure Hidden Fields
Hidden fields are data values submitted alongside visible questionnaire answers without being shown to the user. They are useful for tracking metadata, campaign sources, and pre-populated values from URL parameters.
Prerequisites
Section titled “Prerequisites”- A published questionnaire in Strapi
- Understanding of questionnaire metadata (see Questionnaire Metadata)
1. Add hidden fields in questionnaire metadata
Section titled “1. Add hidden fields in questionnaire metadata”In Strapi, open your questionnaire and navigate to the Metadata section. Add entries to the hiddenFields repeatable component.
Each hidden field has the following attributes:
| Field | Type | Required | Description |
|---|---|---|---|
name |
string | Yes | The field name used when submitting data to the backend |
questionId |
questionId selector | No | Links to a question ID for value resolution |
questionType |
enum: string, number, list |
No | The data type of the hidden field value |
2. Configure basic hidden fields
Section titled “2. Configure basic hidden fields”A minimal hidden field only needs a name:
{ "name": "campaignSource"}This creates a field called campaignSource that gets submitted with the questionnaire data.
3. Set the value type
Section titled “3. Set the value type”Use questionType to specify the data type when the backend needs type-safe values:
| Type | Use case |
|---|---|
string |
Text values, campaign IDs, tracking codes |
number |
Numeric values, scores, thresholds |
list |
Array values, multiple selections |
4. Link to a question ID
Section titled “4. Link to a question ID”Set questionId to reference a specific question in the questionnaire. This allows the hidden field to resolve its value from the answer to that question, useful when you want to submit a computed or transformed version of a visible answer.
5. How hidden fields appear in synced files
Section titled “5. How hidden fields appear in synced files”After syncing, hidden fields appear in the questionnaire metadata as an object:
hiddenFields: {},The object contains the configured hidden field entries, keyed by name.
6. Common use cases
Section titled “6. Common use cases”| Use case | Configuration |
|---|---|
| Track marketing campaign | name: "utm_source", questionType: "string" |
| Store internal metadata | name: "internalPlanId", questionType: "string" |
| Pre-populate from URL params | name: "referralCode", questionType: "string" |
| Pass computed data | name: "riskScore", questionType: "number", linked via questionId |
7. How hidden fields are submitted
Section titled “7. How hidden fields are submitted”Hidden fields are included in the questionnaire submission payload alongside visible answers. The backend receives them as part of the standard answer set — there is no structural difference between a hidden field and a visible answer in the submission.
See also
Section titled “See also”- Questionnaire Metadata — full reference for hidden fields and other metadata
- Create a Questionnaire — end-to-end questionnaire setup
- Pre-fill from URLs — combining hidden fields with URL parameter pre-filling
- Architecture Overview — how questionnaire data flows from the app to the backend