Encoding Link Parameters

Last modified by Kerwin Olfers on 2022/05/25 11:45

Encoding Query Parameters

In Qualtrics information can be added to the end of the distribution link, in the form of query parameters (for beginner information on query parameters in general, see here).

A (working) example sending ppID (participant ID), name, and payment amount, could be: https://leidenuniv.eu.qualtrics.com/jfe/form/SV_78Jw72q1P90evc2?ppID=999&name=Kerwin&amount=3.50.

Sometimes it might be undesirable to have such plain-text query parameters visible in the Qualtrics distribution link. For instance indicating what group someone is in (control vs experimental) could affect the participants expectation and performance, while a visible payment amount poses the risk that the participant will try to alter the amount and reload the survey.

Therefore Qualtrics offers the option to add query parameters that are Base64 encoded.This means that the values are not readable as plain text.

Important note: while a Base64 encoded value it is not visible as plain-text in the URL and browser, this does not equal encryption. A determined and knowledgeable person would still be able to retrieve the information and even manipulate it. So make sure to never send sensitive personal information using this method.

Manually:

  • Write the variable names and values as a JSON formatted string. E.g. for the query parameters name=Kerwin,  ppID=999 and amount=3.50, the string would look like this: {"name":"Kerwin","ppID":"999",amount:"3.50"}
  • Use a Base64 encoding method, e.g. available on this site.
  • This would yield an encoded value that could look like this: eyJuYW1lIjoiS2Vyd2luIiwicHBJRCI6Ijk5OSIsImFtb3VudCI6IjMuNTAifQ==
  • This value can then be added as a query parameter to the distribution link with the name Q_EED (instead of the original parameters),
    e.g.: https://leidenuniv.eu.qualtrics.com/jfe/form/SV_78Jw72q1P90evc2?Q_EED=eyJuYW1lIjoiS2Vyd2luIiwicHBJRCI6Ijk5OSIsImFtb3VudCI6IjMuNTAifQ==
  • If the Qualtrics survey has been set up to look for the name, amount and ppID embedded variables it will now read these from the Q_EED encoded parameter
  • image-20220202140228-1.png

Automatically:

  • We have set up some JavaScript in a Qualtrics Template that you can download here (right-click and "Save link as")
  • To configure this for your study, import the template and modify it directly or copy the question named "Encoding" to your own survey
  • Make sure all embedded variables that you wish to use (including Q_EED) have been created in the Survey Flow before the encoding question.
    image-20220202141733-6.png
  • Open the JavaScript attached to the encoding question to adjust it for your survey
    image-20220202140946-3.png
  • Modify the JSON string line to include the variable names and piped text references to the embedded variables of your choice.
    image-20220202141408-4.png
  • The Q_EED embedded data value will now be set from the encoding question, and can be used for instance in a redirect URL at the end of the surveyimage-20220202142047-7.png