Sona Systems : Cognition Help Page

Cognition Help Page

External Study Credit Granting with Cognition

While these instructions refer to "credit granting", they work for both credit and paid studies. For paid studies, participation will be marked (instead of credit granted) just like with any other paid study.


Here are the basic steps, which are subject to change (since the products are controlled by jsPsych and Cognition.):

  1. On your Sona Systems site, change the Study URL so it includes ?sona_id=%SURVEY_CODE% in the URL. So if the Cognition URL is:
    https://1234abcd.cognition.run
    then change it to
    https://1234abcd.cognition.run?sona_id=%SURVEY_CODE%

  2. Having completed Step 1, the Study Information on your Sona Systems site now displays a URL labeled "Cognition Finish URL". In Cognition, add an on_finish function and provide the Cognition Finish URL value from Sona. The URL to use would be similar to:
    "https://yourschool.sona-systems.com/webstudy_credit.aspx?experiment_id=123&credit_token=4e48f9b638a&survey_code=" + sona_id.



  3. In Cognition, go to the source code of the task for the experiment you wish to link to Sona. Add lines similar to the following block for both on_finish line and the line beginning with let sona_id in the Cognition editor. Use the Cognition Finish URL from the Study Information Page in Sona.

    let sona_id = jsPsych.data.urlVariables()['sona_id']
    jsPsych.init({
    	timeline: [hello],
    	on_finish: function(data){
    
    window.location.assign("https://yourschool.sona-systems.com/webstudy_credit.aspx?experiment_id=123&credit_token=4e48f9b638a&survey_code="+sona_id)
    	},
    })


Thanks to this site for guidance with jsPsych.