Collect hidden values from the survey or form's query string

Overview 

The Hidden value element allows you to collect a value in your responses that's taken from the query string in your survey or form's URL (thus the value isn't directly entered by the respondent).

saf_hidden_value_element.png

This value is then only visible and accessible to you in the response, and not to the respondent.

What's a query string?

A query string forms part of a URL after the question mark - for instance:

https://www.mywebsite.com/?mykey=myvalue

It allows key-value pairs to be passed to a web application or database via a URL. You can have multiple keys and values in a query string, separated by '&' (e.g. mykey1=mykey1&mykey2=mykey2).

Here's an example use case:

Problem

You have a list of staff on your website, and each staff member has a 'Contact me' button, linking to a form that collects a visitor's contact and enquiry details.

However, how will you know which staff member they wish to contact? You could create a form for each staff member - but that's a lot of unnecessary work!

Solution

Create just one form but make use of a query string key-value pair in each button's link to provide the staff member's name, e.g. https://[formlink]?staffmember=[their name]. This name gets stored in the response and you'll know who needs to pick up the enquiry.

diagram-hidden-value-600.png

Setting it up

Using the scenario above:

  1. Add the Hidden value element to your form. Remember - this will show in your reporting, so put it somewhere that makes sense (placing it as the last field in your form is a good option).

    saf_set_query_string_key.png
  2. Click on the element in the form and set up the query string key as 'staffmember' in the side panel

    query_string_key_setup.png
  3. Optional: If you also want the value stored against your contacts, assign it to a contact data field called 'STAFF_MEMBER'
  4. Save the form as usual
  5. Generate the form's share link (which, in this case, will be used for the different 'Contact me' buttons) 
  6. Add a query string to end of the share link that corresponds with each staff member's 'Contact me' button. In Joe's case, his button's URL will be https://[formlink]?staffmember=Joe
Please note: Hidden values only work when a survey or form is shared as a link, not when embedded or as a pop-over.

Viewing the hidden value

Once your survey has at least one response, you can view the hidden value in reporting.

  1. Go to the reporting of your survey
  2. Click on the Responses tab, and open up a response. The hidden field will be shown, along with the value supplied.

    hidden_value_in_response.png

The values can also be included on printed reports, and get included in exports.

Did you find this article helpful?

Can we help?

Thanks for using Engagement Cloud. If you need more help or support, then contact our support team.