Indeed, the version I linked is out of date and the documentation is too. Here is the code I use in a project I have just launched, which I have tested and confirmed that it does save data to the server:
First, the plugin import:
<script src="lib/vendors/jspsych-7.1.2/jspsych.js"></script>
<script type="text/javascript" src="lib/jspsych-7-pavlovia-2022.1.1.js"></script>
Then there are two jsPsychPavlovia timeline elements, and they are the first and last things in the timeline:
// First element in timeline
/* init connection with pavlovia.org */
var pavlovia_init = {
type: jsPsychPavlovia,
command: "init"
};
timeline.push(pavlovia_init);
//Last element in timeline
/* finish connection with pavlovia.org */
var pavlovia_finish = {
type: jsPsychPavlovia,
command: "finish"
};
timeline.push(pavlovia_finish);
I also figured out how to do a redirect from the end of the experiment to prolific by adding an “on_finish” trigger to the second one: How to redirect to Prolific after completing a jsPsych experiment on Pavlovia