URL Variables make for a quick method for pre-populating existing data into a survey. With a simple query added to the end of the survey link, data can be stored as part of each survey response. This gives you the ability to push information into the survey through your survey link to store for use within the survey and/or to use when reporting on the survey response.
In this tutorial, we'll cover how to add URL Variables to your survey links. To learn the basics of URL Variables check out our document on Using URL Variables To Pass Data.
There are two approaches to adding URL Variables to your survey links. The method you use depends on what you are trying to do:
- Group respondents - URL Variables can be added to share links and campaigns to group respondents.
- Identify individual respondents - This tutorial covers how to add URL Variables to group respondents. If you wish to add URL Variables to identify individual respondents, this is typically done manually or with a third party tool like Excel. Keep in mind; Email Campaigns allow you to identify unique respondents without needing to mess with URL Variables.
Option 1: Manually Add URL Variables to Share Links
When using URL Variables to group respondents the most straightforward way is to add them to your share links manually.
For example, let's say you are the general manager of a retail store. You supervise three different regions, each with multiple stores: Northeast, Mid-Atlantic, and Southeast. If you would like to group responses on region, it's as easy as adding a URL Variable called "region" to the share link.
If your share link looks like so:
http://www.alchemer.com/1234567/store-survey
You could simply add URL variables for to create three links as shown below. Then just send out the links to the appropriate store managers:
http://www.alchemer.com/1234567/store-survey?region=northeast
http://www.alchemer.com/1234567/store-survey?region=midatlantic
http://www.alchemer.com/1234567/store-survey?region=southeast
This would then automatically store the region value as part of each response.
Option 2: Create Separate Tracking Links with Unique URL Variables
While URL Variables work flawlessly when present, savvy survey respondents might notice and remove them. To ensure that this doesn't happen, you can create separate tracking links and then add URL variables which will be hidden from view when the link is shared.
To do so, go to the Share tab and click on a survey link from the Email Campaigns and Source Tracking list (bottom-half of the share page). Or if you want to create a new link, click Create A New Tracking Link.
To add a URL variable to each link, go to the Advanced tab of the link editor. In the URL Variables field, you'll enter a variable and value pair like so: variable=value.
For example, let's say we're creating links for each store and manager. We'll start by specifying a variable called region then add an equal sign (=) and the region value this link represents. We can add a second variable by adding an ampersand (&) and then specifying another variable and value pair. Then, we'll repeat these steps for each tracking link we create.
Please note that you do not need to add the question mark at the beginning of the string, it's already built-in!
Which Option Should I Use?
Manually adding URL Variables is the easiest and most straightforward option. However, if you are worried about savvy respondents removing important URL Variables, it is best to use Option 2.
Option 2 is also necessary when your share method is something other than a link, e.g., Embed, QR Code, Email Campaign, etc.
Using URL Variables In Your Survey
That's great you say, but now what? Well, now that you have data from a URL Variable available you could set up logic based on this info. Learn more in our document on Using URL Variables In Logic Conditions.
Check out our Using URL Variables in Your Survey Tutorial for even more powerful things you can do with URL Variables.
Best Practice Tips
- When constructing URL Variables to use in surveys, we recommend using all lowercase letters for the variable name. This will give you the most reliable results for using URL Variables within surveys, as well as passing, them out of surveys using actions like the HTTP Connect and URL Redirect.
- URL Variable values are case sensitive. As a best practice, we recommend passing all lowercase values as well.