1. Knowledge Base
  2. Project Setup Resources

URL Variables

URL variables can be used to store information about respondents that is passed in on the survey entry link (typically from panel providers).

What are URL variables?

URL variables allow you to collect information (typically demographic profiles) about respondents from their survey entry link. You can then use that information to hide/show questions, create survey logic, set quotas, and analyze your survey results.

For example, the survey link https://survey.sightx.io/1234567890?AGE=38&GENDER=2 includes two URL variables for the respondent's age and gender. The variable names are "AGE" and "GENDER"; the text before the equal signs. The variable value for "AGE" is 38, and the value for "GENDER" is 2. In this case, this indicates that the respondent's age is the numeric value 38 (in years). The gender value of 2 is a code, that corresponds with the value "female".

How to create a URL variable

First, you'll need to create a question in the survey to store the variable data. There are three types of data that can be stored in a URL variable:

1. Categorical data: each respondent is assigned to a defined category or group. These variables contain the same type of data as a multiple choice survey question. Common examples are gender, employment status, education level, etc.

2. Numeric data: each respondent is assigned a numeric value. These variables contain the same type of data as a numeric entry question. The most common example is age (in years).

3. Unique/uncategorized data: each respondent is assigned a text string exactly as it is sent in the URL. These variables contain the same type of data as an open text input question. Typically these are used for variables where there are many possible values and/or values that are unique to each respondent.

Tip: If a URL variable has a set of codes mapped to values, the variable is typically categorical and should be set up using a multiple choice question.

Adding a Categorical Variable

For URL variables that will assign each respondent a code that corresponds to a category label, first add a multiple choice question to your survey.

Next, input the possible variable values. These will be the values that show in the raw survey data and the analysis dashboards. We'll use a variable for respondent genders as an example. When you've input all of the possible values, click on the "URL Variables" tab. 

Now, you'll see each option in the question listed with a corresponding input box for the URL code. The URL code is the actual value that will be passed in on the URL, that corresponds with an option label. 

When a respondent's survey link has the variable GENDER=1, they will be assigned "Male" in the survey data, when they have GENDER=2, they will be assigned "Female" in the survey, etc. 

 

The codes and their corresponding values are provided by the panel, community, or list you are sourcing respondents from. They are typically sent in a crosswalk table like this:

URL Code Value

1

Male
2 Female
3 Non-binary
4 Prefer not to answer

 

For the "URL variable name", input the name exactly as it will appear in the URL survey link. Recall that the variable name is the text before the equal sign:

https://survey.sightx.io/1234567890?AGE=38&GENDER=2

The variable names in the example above are "AGE" and "GENDER". These names are typically provided by the panel, community, or database that you're sourcing respondents from, and can be any text string without spaces.

Screenshot 2024-08-20 at 11.50.02 AM

Finally, select your desired behavior if the variable is blank, missing, or has an invalid value on a respondent's survey link. Here you have three options:

1. Show the question to the respondent: if you choose this option, the question will be shown to the respondent in the survey and appear as a normal survey question.

2. Skip this question: the variable will be left blank without a value for that respondent

3. Assign a value: one of the defined variable values will be automatically assigned. For example, you may want to automatically assign "Prefer not to answer" to respondents where the value is missing or invalid.

Adding a Numeric Variable

For URL variables that will contain a numeric value for each respondent, start by adding a numeric entry question to your survey.

 

Edit the minimum and maximum allowed values to contain all possible values of the variable; any numbers outside of this range will be marked as invalid. 

Tip: If you want to disqualify respondents with certain numeric values, include those values in the range, but then set disqualification logic on the question in the Logic tab.

For example, if you have a URL variable for "age" and you only want people who are 18+ to qualify for the survey, you would set the minimum and maximum values to 0 and (we recommend) 110. Then, you would set logic on the question to disqualify respondents under 18.

 

Next, click on the "URL Variables" tab.

 

For the "URL variable name", input the name exactly as it will appear in the URL survey link. Recall that the variable name is the text before the equal sign:

https://survey.sightx.io/1234567890?AGE=38&GENDER=2

The variable names in the example above are "AGE" and "GENDER". These names are typically provided by the panel, community, or database that you're sourcing respondents from, and can be any text string without spaces.

 

Finally, select your desired behavior if the variable is blank, missing, or has an invalid value on a respondent's survey link. Here you have three options:

1. Show the question to the respondent: if you choose this option, the question will be shown to the respondent in the survey and appear as a normal survey question.

2. Skip this question: the variable will be left blank without a value for that respondent

3. Assign a value: assign a specific numeric value to these respondents

Adding a Text Variable

For URL variables that will contain uncategorized text for each respondent, start by adding a text entry question to your survey.

Group 213-1

 

Next, click on the "URL Variables" tab.

Group 214-1

For the "URL variable name", input the name exactly as it will appear in the URL survey link. Recall that the variable name is the text before the equal sign:

https://survey.sightx.io/1234567890?AGE=38&GENDER=2&ZIP=02460

The variable names in the example above are "AGE", "GENDER", and "ZIP". These names are typically provided by the panel, community, or database that you're sourcing respondents from, and can be any text string without spaces.

Finally, select your desired behavior if the variable is blank, missing, or has an invalid value on a respondent's survey link. Here you have three options:

1. Show the question to the respondent: if you choose this option, the question will be shown to the respondent in the survey and appear as a normal survey question.

2. Skip this question: the variable will be left blank without a value for that respondent

3. Assign a value: assign a specific text value to these respondents

Using URL variables in logic or conditional display

Because URL variables are set up inside of a survey question, you can use them for any purpose that you would use a typical survey question for. To hide/show something in the survey based on the URL variable, set logic or conditional display on the question that contains the URL variable.

URL variable settings in survey links

When you're ready to distribute your survey to respondents, go to the Links tab in the Distribute section as you normally would. Here, you'll see listed the URL variables that you set up in the build section. Be sure to include the URL variables in the links you send to your survey respondents. The name in the URL (before the equals sign) should be the exact same including case sensitivity as the one that you gave each variable in the build section.

On the Links tab, you have the option to specify that the URL variables should be required in the survey link. If you set a variable to be "required in URL", respondents will not be able to enter the survey if the link they use does not contain that variable. This overrides the option set up in the build for what should happen if the variable is missing or invalid.

Using URL variables in data analysis

Because URL variables are set up inside of a question, they can be used throughout your data analysis as you would any other survey question. The information will be included in the raw data export, and the questions containing URL variables can be used to filter data, create crosstabs, etc. 

Note: URL variables set up inside text questions cannot be used for filters, etc in SightX, because text questions are limited in the type of analysis that can be done on them.