URL of experiment: https://run.pavlovia.org/nichdima/moral_imagination_MVP
Description of the problem: I am new to Pavlovia and JsPsych (and programming in general!), so I’m struggling with something I hope you all can help me solve. I’m using the pavlovia plug in and following what has been outlined there to try to redirect participants to a completion link at the end of the study. However, I’m not entirely sure how to get them to the page. Here is my code:
var surveyCode = jsPsych.data.getURLVariable('survey_code');
var finishURL = 'https://sona-systems.com/otherinfohere&survey_code=' + surveyCode;
/* finish connection with pavlovia.org */
var pavlovia_finish = {
type: "pavlovia",
command: "finish",
participantId: surveyCode,
// Thomas Pronk; your filter function here
dataFilter: function(data) {
// Printing the data received from jsPsych.data.get().csv(); a CSV data structure
console.log(data);
// You can also access the data directly, for instance getting it as JSON
console.log(jsPsych.data.get().csv());
// Return whatever data you'd like to store
return data;
},
// Thomas Pronk; call this function when we're done with the experiment and data reception has been confirmed by Pavlovia
completedCallback: function() {
alert('Clicking OKAY will redirect you.<a href="' +finishURL+ '" target="blank">');
}