Custom Variables

Often, you will know certain information about a respondent before they respond to your survey, simply based on the place where they saw the survey link.

Custom variables allow you to pass information via the survey web link, which can then displayed within the survey, as well as on any reports generated from the survey.

Because they are transmitted via the URL, Custom variables can only be used by manually editing the values for those variables in the default live survey link e.g. before it is sent out in a letter or email. The link cannot be configured within the SmartSurvey system when creating the survey.

An example web link with the custom variables in blue is:

https://www.smartsurvey.co.uk/s/Surveyname/?Firstname=Bob&Location=Birmingham

Customised links can then be sent manually to respondents. Many organisations use Custom variables by having a CRM system or their website merge these values into the URL when the link is generated for that respondent.

Creating a Custom Variable

To create a variable:

  1. Go to My Surveys and select Design next to your survey
  2. In the Survey Design banner menu, hover over Options and select Custom Variables from the drop down menu
  3. Click Add Custom Variable
  4. Type a Variable Name in the box. This is the text you want to appear in your survey link, naming the variable
  5. Type a Label. This is how the variable name will appear in your results
  6. Click Save Variable
  7. If you want to add more custom variables, repeat this process.

Certain names for variables are reserved and cannot be used as custom variable names. For security reasons, we would prefer not to publish these. If you choose one when creating a custom variable, you will see an error message prompting you to choose a different name.

Using a Custom Variable

To make a custom variable live, you have to edit the survey link, including the Variable Name (see above) and a value for the variable:

  1. Go to My Surveys and click Collect next to your survey.
  2. Hover over Default Web Link and click the Settings icon next to Preview.
  3. Make sure your survey is Open, ensure that you're looking at the live link by checking it doesn't include the word "preview".
  4. Highlight the live link, then copy and paste into a text editor to modify.
  5. At the end of your Link Text, add a question mark (?) If there is already a question mark in the URL, add an ampersand (&) .
  6. Now type your Variable Name. This should be the same as the variable name you gave when Creating a Custom Variable (above).
  7. Next, add an equals (=) sign, then type the value of your variable, followed by a forward slash. For example, if your Variable Name was ‘date’, type the date you want to include as the variable. Make sure there are no spaces. 

If you want to add another variable, add an & sign after the last variable and repeat steps 4-6. You have a maximum of 100 characters.

The final result should look like this example, colour coded so you can see the Domain, Survey Name, Variables, and Values.

https://www.smartsurvey.co.uk/s/Surveyname/?Firstname=Bob&Location=Birmingham

Unique and Mandatory Variables

Below the "Name" and "Label" text boxes are two tickboxes. These allow you to configure the Survey to require that a variable be present, and / or that the value of the variable is unique for every completed response.

The custom variable dialog open in SmartSurvey. Two checkboxes are present "Is Required" and "Unique Value".

Making a Custom Variable Required

To make it so your survey will only load if a value is present for a particular custom variable, edit the variable as described above, then click the tickbox under "Is Required". with this box ticked, the survey will not load unless a value is provided for this variable. If no value is provided, the respondent is shown the same "Survey Link Invalid" message that is shown for any incorrect survey link.

Making a Custom Variable Only Accept Unique Values

To make it so your survey will only load if a provided value is unique, edit the variable as described above, then click the tickbox under "Unique Value". With this box ticked, the survey will only load if the value provided for this variable is unique - meaning that it has not been used to complete this survey before. If a respondent accesses the survey using a previously-used value, the "You have already completed this survey" message will be displayed, and the survey is not loaded.

If no value is provided for the variable, then this does not block further responses from being provided with no value. The lack of a value is not in itself considered a value.

Making a Custom Variable Require Unique Values Only

The fact that the lack of a value is not considered as a value means that, for nearly all applications where you'll want to require unique values for a variable, you will also want to make the variable required.

Requiring Unique Combinations of Values

The "Is Required" and "Unique Value" functions only work on single variables and cannot check for combinations. If you need to check for unique combinations, then you will need to concatenate (join together) your varables in whatever system is generating the links and then use as single variable in SmartSurvey to receive them.

Was this guide helpful?