There is a different way to show videos in your survey, not using YouTube (link to that lesson).

In this lesson, you will learn

  1. How to setup a questionnaire in which participant watch a YouTube video and then are asked to rate it.

  2. How to customize the scoring of a scale item

  3. How to calculate a score and save it to the data file

  4. How to ensure people need to watch until end


Sometimes, people want to show a YouTube video and measure how it affects people or ask people to rate it. You can do this using the PsyToolkit online questionnaires.

You need to use YouTube for this. If you want to use your own video, you will need to upload them on YouTube.

Run the demo

Have a look at what you will get first.

Step 1. Create and upload your video

You can create videos in different ways. YouTube is a create website for enhancing your videos if needed, and it is cost-free. You need to setup your own account if you want to use your own videos.

You might not need to upload your own video, because there are already many great videos on YouTube. This demo uses one of the popular videos.

This lesson does not go into the details of how to setup a questionnaire, because that is already in another lesson. This lesson focuses on a few special features in more detail.


PsyToolkit has a special question item for videos. All it does is just show a video. After you have uploaded your video, or if you want to use an existing video, you need to look for the letter number code. This information can be found in the address line, see picture below:

youtube lesson video

Then in your questionnaire, you can embed this question as follows:

l: my_video_item
t: youtube
q: Please watch the video before you continue
- psvkyf3PzjE


In this questionnaire, we use a rating scale. In this example, it is a three point scale.

scale: like
- {score=-1,image=like1.png} <br>not funny
- {score=0,image=like2.png} <br>neutral
- {score=1,image=like3.png} <br>funny

In this example, please note the following:

  • Within the curley brackets {}, you can give special options for the line

  • The special options in this scale are:

    • A custom score (the default score would go from 1 to 3

    • An image on top of the text

Of course, you can take out the curley brackets part altogether. Then not funny would be scored as one, neutral as two, and funny as three.

The <br> bit in the lines cases a "line break", that is, the text will not be next to the images, but below them.
One you have defined a scale with "scale:", you can use this in as many questions as you want. The question type you can use a scale in is called "scale" as well.


PsyToolkit has a way of calculating the score on a questionnaire scale. Imagine that this is a way to measure a "sense of humor", and people’s score is simply the number of jokes people found funny, whereas a point is subtracted for every video people do not find funny. This way, the humor scale runs from -10 to 10.

You could, in principle, do the calculation of the humor scale after you have downloaded the data, for example in your spreadsheet or statistics program. That would be simple enough, but even easier is to just let PsyToolkit calculate the score. We do that with the "set" item type.

l: humor
t: set
- sum $examplequestion

If you do this, you will for each participant have a value for humor. In this case, it adds up (i.e., sums) all the scores of each of the ten items.

Saving to file

Saving of each question to file is done automatically. In your spreadsheet, you will have for each participant a line, and each column is the value of a variable. One of the columns will be "humor".

Force watching video until end

You can use the mintime option to ensure people cannot continue to next question until video has played until end. Here is how to do it:

  1. Check how long the video is. For example, imagine the video is 2 minutes and 30 seconds long.

  2. In seconds that is thus 60 + 60 + 30 = 150 seconds

  3. Add a mintime option to your code, in this case o: mintime 150s

Full example

l: my_video_item
t: youtube
o: mintime 150s
q: Please watch the video before you continue
- psvkyf3PzjE

Complete survey code

Copy and paste this code to your PsyToolkit account.
scale: like
- {score=-1,image=like1.png} <br>not funny
- {score=0,image=like2.png} <br>neutral
- {score=1,image=like3.png} <br>funny

l: my_video_item
t: youtube
q: Please watch the video before you continue
- psvkyf3PzjE

l: examplequestion
t: scale like
o: random
q: Rate the jokes you just saw
- stick piece of paper on wallpaper
- toilet role folding
- fly and raisin
- sneezing and water drops
- water bottle with holes
- thread out of shirt
- cause mouse problem
- pretend answering machine
- ketchup in drink
- ask friend to watch non-existing video

l: humor
t: set
- sum $examplequestion

l: feedback
t: radio
q: Your sense of humor for practical jokes is {$humor}.
- Not funny!
- Okay, I thought so.
- Ha ha ha.

If you do not want to use the smileys, just remove the image= part of the options in the curley brackets in the scale item, after which it should look like this:

scale: like
- {score=-1} not funny
- {score=0} neutral
- {score=1} funny


You can download the smileys in a zip file. This zip file contains the Inkscape SVG file (for changing the smileys if you want to) and the 3 PNG bitmaps (for upload in PsyToolkit).