How do I use URL Variables to pass in data to my surveys

A common problem for survey publishers is that they want to add data they know about a survey responder to a response without necessarily forcing them to type in or choose the data themselves.  For example, let's say you are sending out a survey to all your customers and want to judge their satisfaction. You want to include in their responses the product they purchased but you don't want to ask your customers to type it in themselves.  You can do this by automatically adding to the survey URL the data you want to marry to the survey response and then we will store it along side the survey response.  How do we do this?  Through the use of "URL Variables".

A URL variable is simply a piece of data that is attached to the end of a URL.  

So instead of a survey url looking like this...

https://s.surveytown.com/survey/?c=200011&id=14

It could look like this...

https://s.surveytown.com/survey/?c=200011&id=14&VARIABLE_NAME=VARIABLE_VALUE

... with a variable name and value attached to the end.  

So, let's say for example you are an online retailer and you want to store along side a response, the product id of the product that the survey taker purchased.  In SurveyTown you could define a variable of "productid" and then when you sent the survey to the respondent you could fill in the product id in the value so the URL would look like this if the product id of the product they purchased was "ABC".

https://s.surveytown.com/survey/?c=200011&id=14&productid=ABC

SurveyTown looks for variables you define and then stores the data when the user completes the survey.  Then when you are looking at the reports the data will show along side the survey responses in the exported report. 

So let's go through the process of creating a URL variable for an example fictional customer satisfaction survey.  For our example let's assume we have a survey with a customer satisfaction question and we are wanting to pass along into the survey the product id of the product the customer had purchased.

So I have already created a survey called "Satisfaction Survey" with one question in it.  Now I am going to create the URL variable.  Here are the steps.

  1. In a Draft survey, go to the URL Variables tab.  
  2. Define the Variable Name - The first input is where you define the variable name.  The variable name can be anything you want but it must
    • Be between 3 and 50 characters long
    • Not use # ? & or ;
  3. Define the Variable Label - This is optional and comes into play when exporting survey responses later.  It is what the column title will be for the data you collect.
  4. Save the URL Variable

In our example I created a variable name called "productid" and a label for the variable of "Product ID".  NOTE: You can add more than one variable if you want by clicking the "New URL Variable" button.

Now we will activate the survey.

The survey is now ready to accept data passed along the URL.  Now in order to test our URL variable is to go where the survey is hosted but fill in the variable with some data.  So in our case we will fill in "productid" with a variable "ABC".  So...

https://s.surveytown.com/survey/?c=200011&id=14&productid=[productid_value]

The [productid_value] will be filled in with the appropriate value like "ABC".

So I am going to open a new browser window and put in the URL...

https://s.surveytown.com/survey/?c=200011&id=14&productid=ABC

... which will store the product ID in the survey.  Below is screen shot of the URL of the survey.

Now, once the respondent submits the survey SurveyTown will capture URL Variable, "productid" in this case, is added to the survey results.  

Please note: if you are testing your own URL Variables more than once then you will want to take the survey in a new Incognito or Private window so the sessions are not stored because stored sessions will throw off your test.

To see the results, you go to the survey report and export the survey responses by clicking on "Export as CSV".

When you open it you will see your value next to the survey response data. 

You can then use this data to slice and dice your responses.

You might be wondering how to create these custom URL strings quickly for all your survey respondents.  This is often done dynamically.  A common thing to do is use email marketing system like Campaigner or Mailchimp to substitute the URL variables at the time of sending.  When the URLs are emailed out the email marketing software automatically inserts the custom field data ( in this case, the product id ) into the URL using custom field data of the user that you import.  You can also dynamically create URLs with custom variables the user is logged into an application and you attach the URL variable on the end of the string.

In summary, survey URL Variables are a great way to augment you survey responses with user data you can pass along to SurveyTown when the user takes a survey.  This helps make your data gather and analysis more efficient and effective.  

Still need help? Contact Us Contact Us