Hello,
I've run 2 iterations of an experiment on Prolific, and the first one sent the data to my server for 80% of the participants, while the second one sent the data for just 40% of the participants. For the participants where the data did send, I have all of their data for all of the trials; it's the ones that didn't send any data that I can't figure out - there is no data file at all for these participants.
There is no javascript error when the 'submit' button is clicked, althought I do sometimes get the error when I start the experiment "The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page." I didn't think this should be an issue, though, since there is not audio input from the participant in the experiment.
All of the participants must have clicked 'submit', since this was the only way to return to Prolific via the url with the completion code.
Could this be a browser issue?
Here is my code for sending the data to the server, and the jspsych.init portion:
function saveData(name, data){
var xhr = new XMLHttpRequest();
xhr.open('POST', 'write_data.php'); // 'write_data.php' is the path to the php file described above.
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.send(JSON.stringify({filename: name, filedata: data}));
window.location = "this was the Prolific URL with the completion code";
}
timeline.push(instructions,pro_id,procedure,final)
var timestamp = Date.now();
jsPsych.init({
timeline: timeline,
on_finish: function(){ saveData(timestamp, jsPsych.data.get().csv()); }
})