About 1/3 of data missing from jsPsych experiment

jsPsych version: 7.1.2
jsPsych-7-pavlovia-2022.1.1

Hi all,

As my first foray into coding, I’ve been working on a jsPsych pavlovia task for the last couple of months, and after sufficient piloting started running sessions with participants. After noticing that many participants (30/100) had completed my qualtrics survey but were missing data for my pavlovia task I sent out emails asking them to redo the task, assuming they had skipped it. Many got back to me saying that they remembered doing the task, and that they were happy to do it again. I then noticed that a portion of those saying they did it had no corresponding data for the task.

All of this means that I am missing data for around 29/100 participants.

Issue possibly at fault:

Because an issue where the task was stalling out on the “Please wait a moment while the data are uploaded to the pavlovia.org server…” I instructed participants to close out of the task, and to return to the qualtrics survey which is in a separate tab, before the “pavlovia_finish” command resolved, using the “Save Incomplete Results” option to record data. This seemed to work fine in pilots, but I am now concerned that this is causing data to not be uploaded properly due to issues with specific browsers or systems. There is also a large discrepancy between the number of sessions (182) and the number of sessions recorded in csv files (115).

Possible Solution:

If the above issue is to blame I could have the task properly execute the finish command and redirect the participants back to qualtrics. However, due to the task stalling out on the “Please wait a moment while the data are uploaded to the pavlovia.org server…” I have been unable to automatically redirect the user after the task. If this would resolve the issue though it is something worth implementing.

Is there a different change I could make that would upload the data without having to utilize the “pavlovia_finish command”? or am I forced to use that command and the resulting end screen.

js for the task

//create timeline//
var timeline = [];

//Get the ResponseID from URL
const queryString = window.location.search;

//Create tasks//

var pavlovia_init = {
    type: jsPsychPavlovia,
    command: "init",
    participantId: queryString
    };


var choice = ['On Phone/Ipad', 'On Computer']

var withPhoneOrComp = {
    type: jsPsychHtmlButtonResponse,
    stimulus: "Are you taking this test on your phone/tablet or on a computer?",
    choices: ['On Phone/Ipad', 'On Computer'],
    data: choice,
};

var startingTrial = {
    type: jsPsychHtmlButtonResponse,
    stimulus: '<span id="instructions">Welcome.<br><br> We are going to play 3 minutes of white noise, during which you will be listening for tones.<br> Each time you hear a tone, click the button on your screen once as quickly and accurately as possible.<br>Do not stop until the white noise ends<br><br> You will be given an example of the tone on the next page.<br></span>',
    choices: ['Next'],
};

var hasHeadphones = {
    type: jsPsychHtmlButtonResponse,
    stimulus: '<span id="instructions">Before we start, please make sure you are using headphones.<br><br>If you are on a mobile device the audio will not function without headphones connected<br></span>',
    choices: ['I have headphones connected'],
};

var instructions = {
    type: jsPsychAudioKeyboardResponse,
    stimulus: 'instructions.mp3',
    prompt: 'Press the button in the next section each time you hear a Tone',
    choices: 'p',
    trial_duration: 27000,
};

var audioTrialPhone = {
    type: jsPsychAudioButtonResponse,
    stimulus: 'NewTask.mp3',
    choices: ['+'],
    button_html: ['<button class="plus-counter">+</button>'],
    response_ends_trial: false,
    trial_duration: 210000,
};

var usedHeadphones = {
    type: jsPsychHtmlButtonResponse,
    stimulus: "Did you use headphones?",
    choices: ['Yes', 'No'],
};

var heardTones = {
    type: jsPsychHtmlButtonResponse,
    stimulus: "Did you hear the tones?",
    choices: ['Yes', 'No'],
};

var endMessage = {
    type: jsPsychHtmlKeyboardResponse,
    stimulus: "You have reached the end of the task, you may now close this window",
    choices: ['-'],
};

var pavlovia_finish = {
    type: jsPsychPavlovia,
    command: "finish",
    participantId: queryString
};

timeline.push(pavlovia_init)

timeline.push(withPhoneOrComp)

timeline.push(startingTrial)

timeline.push(hasHeadphones)

timeline.push(instructions)

timeline.push(audioTrialPhone)

timeline.push(usedHeadphones)

timeline.push(heardTones)

timeline.push(endMessage)

timeline.push(pavlovia_finish)


var jsPsych = initJsPsych({
    timeline:timeline,
  });
  jsPsych.run(timeline)

HTML for the task

<!DOCTYPE html>
<html>
<head>
    <title>Audio Cue Experiment</title>
    
    <script src="jspsych.js"></script>
    
    <script src="plugin-audio-button-response.js"></script>
    <script src="plugin-audio-keyboard-response.js"></script>
    <script src="plugin-html-button-response.js"></script>
    <script src="plugin-html-keyboard-response.js"></script>
    <script src="plugin-survey-text.js"></script>
    
    <script src="jquery-3.7.1.js"></script>
    <script src="jspsych-7-pavlovia-2022.1.1.js"></script>
    
    <link rel="stylesheet" href="styles.css">
    <link rel="stylesheet" href="jspsych.css">
</head>
<body>
    <script src="countTheTonesFinal.js"></script>
</body>
</html>

Try this: How to redirect to Prolific after completing a jsPsych experiment on Pavlovia

I have implemented end of task redirection. Downgrading jspsych-7-pavlovia from 2022.1.1 to 2021.12 fixed the stalling out issue. Does saving the data through the finish command instead of through the “save incomplete results” option account for, and prevent the future occurrence of, the ~1/3 discrepancy between sessions and data recorded? Even with the task finishing properly through the “Pavlovia_finish” command I have 9 sessions and only 6 pieces of data (I created a different experiment to track participants missing data who I followed up with).

The main thing about the redirect in my example is that the redirect itself only triggers at the on_finish event of the Pavlovia “finish” timeline element. That should mean that it only tries to redirect after getting confirmation from the server that it has saved the data successfully.

If you are telling them to close out of the experiment manually, it is possible they are doing so before the save process finishes.

The “save incomplete results” option in the pavlovia dashboard doesn’t actually do anything with jspsych as far as I know. That affects how PsychoJS studies save data, but because you have to manually tell jspsych experiments when to save (usng the pavlovia timeline element), it shouldn’t matter whether you tell it to do this or not, the experiment only tries to upload the data when it hits the pavlovia timeline element.