|Why it's useful|
|What is a query string?|
|Setting it up|
|Viewing the hidden value|
The Hidden value element allows you to include a value from the query string as part of your survey or form response.
It won't display as part of the survey to your respondent, but once your survey has at least one response, you'll then be able to view the hidden value in reporting.
Let's assume you have a list of staff on your website, and next to each one you have a 'contact me' button. The button links to a form that collects a visitor's contact details - but how do you know which staff member they wish to contact? You could create a form for each staff member, but that sounds like a lot of work.
Instead, you can include a hidden value on the contact form that pulls in the staff member from the query string. Each contact button can then include the member's name in the link, and you only need one version of your form.
The query string forms part of a URL - it's the bit that starts after the question mark. For example, in the link:
The query string is 'q=survey'. Query strings let you pass keys and values as part of a URL. In this example, 'q' is the key and 'survey' is the value. You can have multiple keys and values.
- Using the scenario above, let's assume your links from the contact buttons look something like http://[surveylink]?staffmember=joe
- In the survey editor, drag in the Hidden value element. Although the field won't show to your respondents, it will show to you in reporting - so locate it somewhere that makes sense (often putting it as the last field in a survey is a good option).
- Make sure the field is selected, and enter the key of the value you want to pull in in the left-hand side panel (under 'Query string key'). In our example, the key would be 'staffmember'.
- Optional: You can also assign this value to a contact data field (see our guide on this for more details)
- Save the survey as usual
Now, when you link to the survey with a URL that includes the 'staffmember' key on the query string, the value will get included in the survey's response.
Once your survey has at least one response, you can view the hidden value in reporting.
- Go to the reporting of your survey
- Click on the Responses tab, and open up a response. The Hidden value field will be shown, along with the value supplied.
The values are also included on reports and exports.