-
Hello! I have an experiment that uses Cognition.run for hosting and Prolific for participant recruitment. My problem is that, at least some of the time, the results are not fully uploading to Cognition.run before the participant clicks the link to get redirected back to the Prolific website. Here is what the code looks like at the end of my experiment: // blank trial that ends the experiment and takes the participant to the end message
var end_task = {
type: 'html-keyboard-response',
stimulus: '',
choices: jsPsych.NO_KEYS,
trial_duration: 1,
on_finish: function(){
jsPsych.endExperiment(end_message);
}
};
timeline.push(end_task);
// end message
var end_message =
'<p>You have completed the final task. Click on the link below to return to Prolific and finish the experiment.</p>'+
'<a href="https://app.prolific.co/submissions/complete?cc=XXXXXXXX">Click here to return to Prolific</a>'
// initiate experiment
jsPsych.init({
timeline: timeline,
show_preload_progress_bar: true,
show_progress_bar: true,
auto_update_progress_bar: false,
}); Sometimes it is just the data from the final task that has failed to upload the server, and in at least one case it was the data from the last two tasks that failed to upload. This struck me as strange because I thought that Cognition.run saves data to the server incrementally as participants are working through the experiment. Maybe that is still what was happening but the user in question had an especially slow internet connection? When I was testing the experiment on myself, I had a warning message pop up once when I tried to click on the Prolific link before the data had finished uploading to the server. I guess that I could add a sentence to the end message asking participants to wait a bit and try again if their browser gives them a similar warning, but I don't see that as a permanent solution. Is there something I can do to make sure that the data finishes uploading to Cognition.run before the participant sees the end message with the link to return to Prolific? I found a few other people who have already posted related questions, but fixing the problem was a bit different for them because they were all using their own servers. Any help you could give me would be very much appreciated. Or is this a question I should be directing to the Cognition.run creators instead? Thank you for your time. |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 8 replies
-
Hi @fzenk, I'm afraid I can't think of a way to improve your code to deal with this problem - hopefully others will chime in if they have any suggestions. Also tagging the cognition.run creator @javidalpe in case he can help! |
Beta Was this translation helpful? Give feedback.
-
Hello @fzenk and @becky-gilbert. I found the issue. I propose two solutions: What do you think @becky-gilbert . More than happy to work on any :) |
Beta Was this translation helpful? Give feedback.
-
Hello @jodeleeuw! I'm wondering what you think about this issue. It seems to me that this is an important one to get resolved for anyone who wants to use jsPsych + Cognition for their research. @javidalpe has kindly offered some possible fixes, but I think he and @becky-gilbert are waiting for your input before going any further. Thank you :) |
Beta Was this translation helpful? Give feedback.
-
I've opened an issue to track this #2050. I think we should modify the behavior of |
Beta Was this translation helpful? Give feedback.
-
Thank you @jodeleeuw! On the meantime @fzenk , I was wondering if you tried another approach. Today I was thinking that you could use the global on_finish callback to redirect the user to prolific instead of manually ending the experiment. This should work: // Example trial, could be any trial
var hello_trial = {
type: 'html-keyboard-response',
stimulus: 'Hello world!'
}
var timeline = [hello_trial];
// Final trial before redirect
var end_message =
'<p>You have completed the final task. Press any button to return to Prolific and finish the experiment.</p>';
var end_task = {
type: 'html-keyboard-response',
stimulus: end_message,
};
timeline.push(end_task);
// initiate experiment
jsPsych.init({
timeline: timeline,
show_progress_bar: true,
on_finish: () => window.location.href = "https://app.prolific.co/submissions/complete?cc=XXXXXXXX"
}); |
Beta Was this translation helpful? Give feedback.
I've opened an issue to track this #2050. I think we should modify the behavior of
on_finish
to accept a promise.