3. Advanced Qualtrics

Adding Custom Java Script and HTML

  • How to access and write values to an embedded data field at any point in the survey
    • To access embedded data at any time using javascript: simply set a variable to be equal to the piped text required to access to embedded data in survey questions (as a string).
      • For example,
        • var myData = "${e://Field/myEmbeddedData}" (don't forget the quotes!)
    • To write a new value to an embedded data field, use the call Qualtrics.SurveyEngine.setEmbeddedData('fieldName', newvalue);
      • For example, to change the value of the embedded data field myEmbeddedData to be equal to 10, write
        • Qualtrics.SurveyEngine.setEmbeddedData('myEmbeddedData', 10);
    • There are also a handful of other ways to handle embedded data.
      • addEmbeddedData('name', value); adds embedded data.
      • setEmbeddedData('name',value); sets the embedded data.
      • getEmbeddedData('name'); returns the embedded data.
    • The relevant Qualtrics javascript file can be found at:
      • https://a248.e.akamai.net/img.qualtrics.com/WRQualtricsShared/JavaScript/javascriptSE.31984.js
      • Note: It appears that panels, unlike embedded data, cannot be set via javascript.

Using the Qualtrics REST API

Qualtrics has a REST API which can be used to do a variety of things, from updating panels to downloading survey response data. Information on all of the functions available to use can be found at the API documentation.

To use the API, you'll need a token. This is a secret key that is used to identify you to qualtrics. Note that not all account types have access to the API and API tokens - you may need to ask your brand administrator to allow you to access the API. 

To view or generate an API token, use the following instructions, taken from Qualtrics' page on authentication:

To generate/regenerate your token:
  • Login to Qualtrics via your browser. Click your name in the upper right, then go to 'Account Settings.'
  • Select 'Qualtrics IDs,' just under the main tabs.
  • Under 'API' click 'Generate Token.'
  • Your token will be displayed. Copy it into a safe place to use with your application.
You can view your current token at any time by navigating to the 'Qualtrics IDs' section. You can also generate a new token at any time and regenerate it as often as needed.

Adding Custom CSS

Qualtrics doesn't allow you to "directly" look at the CSS files, but in the advanced settings of the look and feel tab, you can override the CSS with your own rules.
However, if you actually want to look at the CSS of the actual pages, one method is to download the actual webpage (ctrl-s as a complete webpage, then open up the html file or css file in a separate notepad).
http://www.qualtrics.com/university/researchsuite/example-style-sheet The above link has some of their "standard" css rules, which illustrate what some of what they use by default.

  • Record the order of items in a Loop & Merge using Custom Javascript
  • Record key presses as responses using Custom Javascript
  • Play sound files
  • Play videos
  • Uploading & inserting Images from the library
  • Inserting images from the library using URLs
  • Inserting images from a website using URLs, which makes it much easier to change stimuli
  • Scoring function
  • Use a matrix question to collect binary and ordinal judgments
  • Import and Export Surveys
  • Using the scoring function

Using Qualtrics on Amazon Mechanical Turk
  • Use exactly the same survey for lab and online participants – even when they have to see different questions
    • Use Branches in Survey Flow that are based on participant = mturk, or participant = lab. Pipe this embedded data field in using the URL: Appending embedded data to URL

End of survey items in the survey flow (can be used to terminate if consent not given, etc)

The survey can generate a unique number for each participant

Avoid misalignments of data across experiment versions
  • When questions are removed from a survey the data can be lost or alignment changed. Don't delete them. Instead place them inside Branches in Survey Flow that are never satisfied. The Branch would be activated if thisifstatement = neversatisfied
    • For instance, you can set your condition to be based on the value of an embedded data field called "FreePass" and have it only be true if FreePass = 0.
      • Note that you do not actually need to have an embedded data field called FreePass -- if your data field does not exist, the conditional will never be satisfied.


How to generate 'fictional' participants to test a survey

Create a "panel" that can be used to link information about survey participants to their survey, when the survey is distributed by email 

Using panel triggers (Adds participants to a panel based on their response to a question, and other features. Can also have "email triggers")

This authenticator requires participants to give login information:
  • Use a WebService (interact with any script stored on a server by sending and receiving fields)
  • Automatically add embedded data fields to a survey by adding extra text to the url participants are given. (Note, this can then be accessed by normal syntax, e.g. ${e://Field/pipedin}, but to have it saved with participants' response reports, the field must be set in the survey flow, as shown below)

How to hide radio buttons