Multiple Stimuli, One Question using Qualtrics

Do you have a set of stimuli (images, videos, etc.) that you want to ask your participants about? Qualtrics has a useful Loop and Merge feature that can allow you to do that. Here is how to set it up.

Note that this tutorial assumes a working knowledge of Qualtrics, which has great documentation for any general questions you have.

Step 1: Upload your stimuli to your Qualtrics Library

If your images or videos are already stored on the cloud and are accessible via a URL, skip this step.

Let us say you have a set of videos labeled 001.mp4, 002.mp4, and so on. You should first go to the Library Tab at the top of Qualtrics and then click on the Files Library Tab.

I prefer to create a folder using the button on the left to store all my files for a particular survey.

Go to the Upload a New File button and upload all your .mp4 files

Step 2: Creating your spreadsheet

I use Excel for this, but any spreadsheet software should work.

Set up a spreadsheet that looks like this, with a row for each of your stimuli. See the column and row labels. We will use these later.

A B C
1 Video Name File ID HTML
2 001
3 002

We will now fill out each of these columns

Step 3: Getting your File IDs

Go back to your Qualtrics Library. Click on the first video 001.mp4, and click View.

The video should open in a new tab with a URL that ends with F={{FILE ID}}, where the FILE ID starts with a F_.

Copy that file ID and paste it into the second column of your spreadsheet. Repeat for each video.

Step 4: Creating your Question Block

Now go into your survey. Create the question as you would like it to appear for 001.mp4. For example, the HTML view for a centered video with full width and automatic height might look like this:

<video class="qmedia" controls="true" height="auto" preload="auto" width="100%">
    <source src="{{URL HERE ENDING WITH FILE ID}}" type="video/mp4"><embed align="middle" autoplay="false" bgcolor="white" class="qmedia" controller="true" height="auto" pluginspage="http://www.apple.com/quicktime/download/"  src="{{URL HERE ENDING WITH FILE ID}}" type="video/quicktime" width="100%">
</video>

Do you see where the URL appears in the HTML? The File IDs that we copied in Step 3 are the ending of that URL. Ideally, we want to change those File IDs at each iteration to match the ID for each video.

Step 5: Creating your HTML

Unfortunately, we cannot simply insert the new File ID in the middle of the HTML. So here is the work-around and the reason we need a spreadsheet.

Copy the HTML for your question into a text editor that allows you to Find and Replace.

For this text to be a valid equation, we need to make a few replacements.

  • Quotes ("") are special characters in equations, so we need to replace each " with a double quote ""
  • We cannot have an equation that is this long, so we need to add some concatenation symbols. Every ~200 characters in your equation, replace a space with " & "
  • Add an = to the beginning of the line

For example, the HTML example from above would become:

=<video class="qmedia" controls="true" height="auto" preload="auto" width="100%">
            <source src="{{URL HERE ENDING WITH FILE ID}}" " & " type="video/mp4"><embed align="middle" autoplay="false" bgcolor="white" class="qmedia" controller="true" height="auto" " & " pluginspage="http://www.apple.com/quicktime/download/"  src="{{URL HERE ENDING WITH FILE ID}}" type="video/quicktime" " & " width="100%">
</video>

Now look at your spreadsheet. Your first File ID is located in cell B2.

**Find the File ID in your HTML and replace it with " & B2 & ". **

You are now ready to copy your equation into cell C2. The File ID from video 001.mp4 should automatically be populated into cell C2. If you drag this equation down column C, you now have all your HTMLs!

Step 6: Question Randomization

Unfortunately, the default randomization within Loop & Merge in Qualtrics does not have a way of ensuring that each stimuli is shown an equal number of times. The way to achieve this is complicated, and credit to this for the idea.

Before the question block, add another question block. This question will be hidden and will just function as a way to randomly choose the subset of stimuli each participant will view.

Create a multiple choice question in your question block. In the question text, go to HTML view and paste this text

<script>
      Qualtrics.SurveyEngine.addOnload(function() {
      var questionDiv = this.getQuestionContainer();
      questionDiv.style.display = "none";
      this.clickNextButton();});
</script>

This will ensure that this whole block will be hidden from your participants.

Now copy Column C in your spreadsheet from Row 2 down. Click into the first of the multiple choice answers and paste. This will create an answer choice for each of your stimuli. It may take a long time to save the survey, so be patient with it.

Next click on the gear icon next to the question and go to Randomization. Click Advanced Randomization -> Set Up Advanced Randomization.

On the left side of this window, you should see all the choices, one for each stimuli. The middle box on the right side titled Random Subset has a right arrow next to it. Click this right arrow until all your choices are populated in the Random Subset box. Click Evenly Display Choices and put in the number of stimuli you want to present to each participant. Hit Save twice.

This means that your hidden question will randomly choose a subset of your stimuli.

Step 7: Completing the Loop & Merge

Now we need to ask a question for each of these stimuli

Go to Block Options -> Loop & Merge in your question block, and turn on Loop & Merge.

Click Loop based off a question and then select your hidden question. In the second drop-down, select Displayed Choices. A large number of blue rows should appear, one row for each stimuli.

Hit Save.

Now in your question text, you can put something like this to display the Question Number as well as the stimuli.

Question ${lm://CurrentLoopNumber} out of 10

            ${lm://Field/1}

Test our your new set of questions by hitting Preview at the top and trying out your survey

Last updated: October 2020
Originally published: July 2020