Skip to main content
Loading...
Skip to article
  • Qualtrics Platform
    Qualtrics Platform
  • Customer Journey Optimizer
    Customer Journey Optimizer
  • XM Discover
    XM Discover
  • Qualtrics Social Connect
    Qualtrics Social Connect

Passing Information via Query Strings


Was this helpful?


This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The feedback you submit here is used only to help improve this page.

That’s great! Thank you for your feedback!

Thank you for your feedback!


About Query Strings

A query string allows you to pass information to and from a website by simply adding, or “appending,” that information to the end of a URL. This information is stored in the query string and is captured by the website when it reads the URL.

Data can be passed into a survey using a query string. Once passed, the data can be saved as embedded data with the survey response. At the end of a survey, query strings can be used to pass data to another website or survey.

Query String Structure

General Query String Structure

Query strings follow a very specific syntax. They are added to the end of a URL in the general format of ?FieldName=FieldValue. The FieldName is the name of your data field while FieldValue is the specific data value of your field. Let’s take a look at an example URL with a query string appended to it. The query string is in bold.

https://survey.qualtrics.com/jfe/form/SID=SV_1234?Source=Facebook

When a respondent takes the survey with the above link, the data field “Source” with a value of “Facebook” will be saved with the response.

Multiple Query Strings in One URL

Query strings allow you to pass multiple pieces of data within a single URL. However, when your URL contains multiple query strings, the syntax is a bit different. Let’s take a look at a URL with multiple query strings appended to it. The query strings are in bold.

https://survey.qualtrics.com/jfe/form/SV_123456789?Source=Facebook&Campaign=Mobile

The second query string begins with an ampersand (&) instead of a question mark (?). This is because URLs can only support one question mark. Additional query strings can be appended by adding more fields in the format of &FieldName=FieldValue.

Attention: While there is no Qualtrics limit to the amount of data you can pass via query strings, web browsers do have URL character length limits. These limits vary by browser. We recommend trying to keep your URLs below 2,000 characters. For information about a specific browser’s limits, consult the browser’s help documentation.

Combining Query String Values in Response Data

You can pass multiple values for the same field within a query string. The result will be a combined field in your response data that is separated by commas.

For example, if you pass the following query string:

https://survey.qualtrics.com/jfe/form/SV_9GfoihavJJR5R7U?Client=ATT&Client=Sprint

The result will be that the “Client” field has a value of “ATT,Sprint.”

close up of Recorded Responses section

Passing Information into a Survey

You can use query strings to pass information into a Qualtrics survey. You can save this information as embedded data and then use this field in branch and display logic along with saving the data with the survey taker’s response.

Example: You can use a query string to track from what source a participant is accessing a survey. Let’s say you’re running a survey on multiple social media sites. If you want to track which participants are coming from Facebook and which are coming from LinkedIn, you could create 2 customized links (query strings in bold).

https://survey.qualtrics.com/jfe/form/SID=SV_1234?Source=Facebook
https://survey.qualtrics.com/jfe/form/SID=SV_1234?Source=LinkedIn

These query strings will save 2 different values for the field “Source”. These values are “Facebook” and “LinkedIn”. You can then use this data in your reporting, pipe it into questions to display for your respondents, and base branch and display logic on it to show or hide relevant questions.

Passing information into a survey via query strings requires a 2-part setup. The first part consists of appending data to your URL with query strings, and the second part consists of creating embedded data elements in your survey flow to capture the information from the URL.

Part 1: Appending Data to a Survey URL

  1. Copy the anonymous link for your survey and paste it into a text editor, such as Word or Notepad.
    https://survey.qualtrics.com/jfe/form/SV_123456789
  2. Add a question mark (?)to the end of the URL.
    https://survey.qualtrics.com/jfe/form/SV_123456789?
  3. Type the name of the Embedded Data field (e.g., “state” or “city”) after the question mark.
    https://survey.qualtrics.com/jfe/form/SV_123456789?city
  4. Add an equal sign (=)
    https://survey.qualtrics.com/jfe/form/SV_123456789?city=
  5. Type the value of the field (e.g. “Utah” or “Provo”)
    https://survey.qualtrics.com/jfe/form/SV_123456789?city=Provo
  6. For any additional fields you’d like to add, repeat steps 2 through five using an ampersand (&) instead of a question mark (?).
    https://survey.qualtrics.com/jfe/form/SV_123456789?city=Provo&state=Utah

Part 2: Capturing Information from a URL as Embedded Data

  1. While editing your survey, navigate to the Survey flow by clicking the survey flow icon in the left navigation bar.
    navigating to the survey flow by clicking the survey flow icon on the left navigation bar
  2. Click Add a New Element Here.
    The survey flow. click Add a new element here
  3. Select the Embedded Data element.
    a new survey flow element. select embedded data
  4. Enter the name of any fields you’d like to capture from the URL. Do not assign a value for these fields. For these fields, it should read Value will be set from Panel or URL.
    an embedded data element with 2 fields corresponding to our query string

    Qtip: The capitalization of your fields matters! Make sure your fields in your survey flow match the capitalization of the fields in your URL.
  5. Move the embedded data element to the top of your survey flow. This is especially important if you want to use the embedded data fields in logic or want to display the values with piped text. The embedded data element must appear before the elements in the survey flow that reference it.
    the embedded data element has been moved to the top of the survey flow

    Example: In the Introduction question block, we want to pipe in the value for “city” into some question text. Therefore, we need to move the embedded data element to before the Introduction question block in the survey flow.

Passing Information from a Survey

You can pass information from a survey to another website or from 1 survey to another survey by appending information to the redirect URL. This is commonly done when working with a third party panel provider.

Attention: The redirect destination needs to be configured to accept the information passed in the URL. Otherwise, the passed information won’t be captured. See passing information into a survey above to learn about configuring a survey to accept information passed in the URL.

To Pass Information from a Survey

  1. Generate the piped text code for each piece of data you would like to pass  (e.g., answers to survey questions, embedded data, or any other information collected with the response). Copy these codes and save them for later.
    Example: We want to pass along the respondent’s answer to two of our survey questions. The piped text for our selected survey questions are ${q://QID7/ChoiceGroup/SelectedChoices} and ${q://QID3/ChoiceGroup/SelectedChoices}.
  2. Copy the redirect URL. This is the URL you want to send survey respondents to and will be the website that captures the information.
    Example: We’re redirecting from one Qualtrics survey to a third party panel provider, so our URL is https://www.survey.panelcompany.com
  3. Add a question mark (?) to the end of the URL.
    https://www.survey.panelcompany.com?
  4. Type the name of the variable you’d like to pass.
    https://www.survey.panelcompany.com?Q7Answer
  5. Add an equal sign (=) to the end of the URL
    https://www.survey.panelcompany.com?Q7Answer=
  6. Paste the piped text code for the value for the variable.
    https://www.survey.panelcompany.com?Q7Answer=${q://QID7/ChoiceGroup/SelectedChoices}
  7. Repeat steps 3 through 6 for any additional variables you’d like to pass. Use an ampersand (&) instead of a question mark (?) for additional variables.
    https://www.survey.panelcompany.com?Q7Answer=${q://QID7/ChoiceGroup/SelectedChoices}&Q3Answer=${q://QID3/ChoiceGroup/SelectedChoices}.
  8. Paste your completed URL from step 7 in the appropriate survey termination area (e.g., default or survey flow element).
    Qtip: Do you have a query string that does not seem to be working? It might have to do with how your piped text is formatted. Best practice is to add ‘?format=urlencode’ to the end of piped text values, before the last bracket. This ensures values with spaces and special characters carry over properly into the query string. For example, pull embedded data called Department into your query string by using ${e://Field/Department?format=urlencode} instead of ${e://Field/Department}. However, don’t add format=urlencode to Email fields. This will convert the @ symbol to %40.

After making your redirect link, you’ll need to make sure your redirect website can capture the information from the query strings. If you’re redirecting to a Qualtrics survey, details about preparing your survey to capture the information can be found in Part 2 of the passing information into a survey section above.

Some of the Qualtrics email editors contain piped text for your survey link instead of the survey link itself. This includes emailed survey invitations along with the XM Directory task. You can add query strings to the piped text for these links so that the query strings are added to the link when the email sends. One such scenario where this is useful is if you’re sending many similar distributions and want to track which responses come from which distribution. Extra steps need to be taken to make sure your link is built and hyperlinked properly in your Qualtrics emails.

  1. Open the email editor and begin composing a message. This could be the email editor for email survey invitations, or the XM Directory task.
  2. If your message already has piped text code for a survey, delete the code. Survey link piped text code is generally in the format of ${l://SurveyURL}. We do this to ensure the link we build is free of errors.
    the email editor with piped text for survey links
  3. Click the piped text icon {A} and select Survey Links → Survey URL.
    the email editor. click the piped text button --> survey links --> survey URL to insert the correct piped text
  4. Build your link using the instructions from Part 1 of passing information into a survey. The piped text code that you inserted will act as your URL.
    Qtip: When building your query strings, make sure to use an & for each string, as the individual survey link will already contain query strings.
    Example: Let’s say we’re sending a survey out in waves and want to track which wave a respondent was a part of. Our URL in the email editor will look like ${l://SurveyURL}&Wave=wave1
    Qtip: You can also use piped text for your query string variables and values. However, to make sure your piped values are encoded correctly, you need to add &format=urlencode to the end of piped text values, before the last bracket. This ensures values with spaces and special characters carry over properly into the query string. For example, pull embedded data called Department into your query string by using ${e://Field/Department&format=urlencode} instead of ${e://Field/Department}. However, don’t add format=urlencode to Email fields. This will convert the @ symbol to %40. Additionally, do not add format=urlencode to the piped text for the survey URL.
  5. Copy the newly created link and highlight the link in the message editor.
    highlight your URL in your email editor and click the hyperlink button to hyperlink the URL
  6. Click the hyperlink button.
  7. In the URL box, paste your copied link.
    hyperlinking the survey link
  8. Change the protocol to <other>.
  9. If desired, change the Display Text of the link, e.g., “Click here to take the survey.”
  10. Click OK.

How to Use Q_EED

Q_EED can be used as a URL parameter to pass obfuscated (or Base64 encoded) embedded data parameters. One of the most common use cases is to pass JSON data in a binary format through a URL.

In the example below, we are going to communicate a respondent’s gender (Male) and age (32) into a Qualtrics survey using Q_EED appended to the end of a survey link as a query string.

  1. Add the embedded data Gender and Age to your Survey Flow.
  2. Write out the information you want to pass in JSON format. For example:
    {"Gender":"Male","Age":32}
  3. Now Base64 encode the entire JSON format, from bracket to bracket. Make sure to check Perform URL-safe encoding when encoding your data. Once encoded, the JSON from Step 2 looks like this:
    eyJHZW5kZXIiOiJGZW1hbGUiLCJBZ2UiOjMyfQ==
  4. Add the string from Step 3 as the value of the Q_EED field:
    Q_EED=eyJHZW5kZXIiOiJGZW1hbGUiLCJBZ2UiOjMyfQ==
    
  5. Get your survey URL.
  6. If the URL has a question mark (?) anywhere in it, add an ampersand (&) to the end. If there is no question mark, then add a question mark (?) to the end.
  7. Add the result of Step 4 to the end of your URL. It should now look like this:
    https://survey.qualtrics.com/jfe/form/SID=SV_1234?Q_EED=eyJHZW5kZXIiOiJGZW1hbGUiLCJBZ2UiOjMyfQ==
Qtip: Do not vary the spelling, punctuation, or case sensitivity of your variables. If your survey flow says “Gender,” the G must always be capitalized to successfully encode and then carry this information over.
Warning: For security purposes, encoded strings cannot contain plus signs ( + ), or the embedded data will not be recorded. Use dashes ( ) instead.

How to Use Q_PopulateResponse

Q_PopulateResponse is used as a URL parameter to pre-populate survey responses.

Values are passed through the URL as JSON formatted fields:

YourSurveyURL?Q_PopulateResponse={"QID1":"6","QID2":"4","QID3":"this is my text","QID4":"1"}

If you want to pipe in last year’s answers to this year’s surveys, you can upload the answers as embedded data to a contact list and then set up a custom individual link that references these answers. First, write out some clickable text in your distribution email, then get the piped text for the survey URL, and then use the link button in the rich content editor to link to something like this:

${l://SurveyURL}?Q_PopulateResponse={"QID1":"${e://Field/QID1}","QID2":"${e://Field/QID2}","QID3":"${e://Field/QID3}"}

This example is referencing the contact fields QID1, QID2, and QID3. Be sure to encode the quotation marks (“) with %22, but do not encode the entire URL string as it will disable the piped text.

This link will populate last year’s answers. If the person changes some of these default answers and then exits the survey, when they re-enter the survey, the most recent save overrides what the URL states should be populated. Also, if there is display logic on a question, it will fill that question, but it will not be recorded unless the person chooses the correct logic that would display that question.

Qtip: See the FAQs at the bottom of the page for help with JSON formatting.

Common Use Cases

Below are some common Qualtrics use cases that use query strings. Visit the linked pages for more information.

Types of Projects You Can Use Query Strings With

Query strings can be used with any type of project that has a link. This includes:

Qtip: This support page was written with survey projects in mind. Not every use case discussed on this page is relevant to every project type.

FAQs