Have Questions? (800) 477-0970

Pushing Values into the Survey through the Query String: Part 1


Please Note:This is a tutorial for SurveyGizmo 2.0 users. We will be updating this for SurveyGizmo 3.0 users ASAP

Whether it is referred to as query strings, token variables, GET string variable, or URL variable patterns, it all means the same thing: The ability to ‘push’ information into the survey through the survey link. The act of sending this information into the survey through the survey link is called passing.

Basic Query String Construction

Caution: Constructing your survey link with a query string must be done separately from the Publish tab within SurveyGizmo. The link with the query string should be used for sending emails through your own mail service or when placing the links on particular websites or sources. Do not place query string values within the custom link areas of the Publish tab.

Take the following imaginary survey link:

http://www.surveygizmo.com/s/12345/my-survey

If you wanted to pass a variable with the value equal to the word ‘value’, you would then add the following to the survey link:

?variable=value

This would make your survey link as follows:

http://www.surveygizmo.com/s/12345/my-survey?variable=value

If you wanted to add a variable named ‘userid’ with a value of ’121′, and also include a variable named ‘name’ with a value of ‘Bob’ it would look as follows:

http://www.surveygizmo.com/s/12345/my-survey?userid=121&name=Bob

You have probably noticed a few symbols are being used as part of the query string. They are identified in blue in the examples and represent the syntax of a query string. Let’s explain these quickly.

  • ? – (Question Mark) This identifies the beginning of the query string and must be placed between the link and the contents of the query string.
  • & – (Ampersand) This is used to add additional variable/value data in the query string and is used before each addition variable/value pair.
  • = – (Equals, not in blue) This separates the variable from the value assigned to that variable

Now that the structure is clear, it’s time to learn about the restrictions within SurveyGizmo for using the query string.

Restrictions Within SurveyGizmo

There are a few key rules regarding the query string:

  • Do not use the variable names id, sguid, or survey, these are reserved
  • Do not use any symbols or numbers in the variable name, letters only
  • Spaces are not allowed in the variable name and should be replaced with %20 if in the value field (e.g. ?name=John%20Smith )
  • If the value contains symbols, the query string should be created by URL encoding the value. This can be done in many programming languages easily, such as with PHP and ASP.

The following are examples of invalid query strings (do NOT do these):

  • ?user_id=123
  • ?id=6323
  • ?survey=8423
  • ?1name=Bob
  • ?name=Bob Edward Jr.

Viewing the Submitted Variables within SurveyGizmo

SurveyGizmo captures all variables (excluding the restricted ones mentioned above) as part of that particular response. If you go under Reporting, you will be able to browse individual responses. Within these individual responses will be a section at the top called Token Variables. This will display any variables and their values captured from the query string. In the following example survey link:

http://www.surveygizmo.com/s/12345/my-survey?userid=042684

The response would capture the following Token Variables information:

URL: userid042684

If you wish to see the Token Variables across all your responses without any extra survey design, you can Export to Text (.csv) and a column will be added to the exported file for each variable (‘userid’ in the above example) and each row of the file will contain the value for that particular respondent (if applicable).


In Part 2:Query String Integration, of this series, methods for using the query string value within your survey are explored. Part 3:Query String Examples, follows with specific use cases and examples of using query strings in a real world example.

Have you tried SurveyGizmo yet? Try our 14 day free trial

The Survey Expert Blog

By

Why Survey Design Matters for Feedback Surveys

February 3 2012 -

Survey Expert Ryan Farmer observes that many well-known companies aren’t branding their surveys, and discusses why survey design is hyper-important when you want to gather customer feedback.

By

New Team Management & User Permissions System

Starting February 2nd, SurveyGizmo is launching a new set of user management features. Learn more about them here!

By

5 Questions with SurveyGizmo co-founder and CEO Christian Vanek

Boulder’s Daily Camera newspaper interviews Christian Vanek, who shares what’s next for the company.

More from our Survey Experts