Hidden Variables
Updated
On this page
A hidden variable is a tag in the survey link, for example ?source=newsletter. Its value isn't shown in the survey and is saved with the response, so you can see which channel a response came from, link it to an order or a customer, or address the respondent by name without asking extra questions.
Adding variables to the link
- Publish the survey. The Share tab becomes available after the first publication.
- Open Share and go to URL parameters.
- In Variables in the link, click a ready-made name (1): source, utm_source, utm_campaign, client_id, email, order_id or name.
- To add your own variable, type its name under Custom variable and click Add (2).
- In Link with variables, click Copy link (3).

The copied link has a placeholder for each value:
https://your-account.surveyninja.io/a1b2c3d4?source=xxxx&order_id=xxxx
Replace each xxxx with a real value before you send the link. For example, use social in a social media post and email in a newsletter. Respondents who open the link with different values answer the same survey, and you can split their responses by the value.
To remove a variable, click the cross next to its name. The variable is removed right away, without confirmation. Logic conditions that use it stop working, and it disappears from question titles where you inserted it.
Passing values from an email service
Most email services can put the recipient's data into a link. Use the service's merge tag as the value, and each recipient gets a link with their own data. For example, with the Mailchimp merge tag for the recipient's email, the link looks like this:
https://your-account.surveyninja.io/a1b2c3d4?email=*|EMAIL|*
Other services use their own tags. Check the tag name in your service's help.
Where to find the values
- Results → Responses: every response that came with variables has a Hidden values block (1).
- To show only responses with a certain value, use the Hidden Variables filter in Results.
- In CSV and XLSX downloads, each variable is a separate column named after the variable. See Viewing and Downloading Survey Responses.

Using variables in the survey
- Logic jumps. In a logic jump condition, choose a variable instead of a question and compare its value: Equals, Contains, More than, Passed, Not passed and others. You can also click Add hidden variable right in the condition. See Logic Jumps.
- Question text. Type @ in a question title or description and pick the variable. The respondent sees the value from the link, for example "Anna, how did you like your order?". See Reusing Answers in Survey Questions.
- Redirect link. On the Thank You Screen, turn on Action button, choose Follow the link and click Answer from question under the URL field. Pick a variable to pass its value on to your site.
- Embedding on a website. The code in Share → On website already includes your variables with xxxx placeholders. Replace them with real values before you add the code to your site.
Limits
- A variable name can contain only Latin letters and underscores, for example order_id. Digits and spaces aren't allowed.
- Names are saved in lowercase. Use lowercase names in the link too, otherwise the value may not appear in question text.
- If the link doesn't contain the variable, question text shows ___ in its place.
- In logic, values are compared without regard to case: Social equals social. If the link doesn't contain the variable, Equals and Contains conditions aren't met, and Does not equal and Not passed conditions are met.
- If you use a variable in question text or in logic, publish the survey again so that respondents get the changes.
25 Questions for a Construction Customer Satisfaction Survey