Sona Systems : oTree Help Page

oTree Help Page

External Study Credit Granting with oTree

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 product is controlled by oTree):

  1. On your Sona Systems site, change the Study URL so it includes ?participant_label=%SURVEY_CODE% in the URL. So if the oTree URL is:
    http://otree.yourschool.edu/room/my_room_name/
    then change it to
    http://otree.yourschool.edu/room/my_room_name/?participant_label=%SURVEY_CODE%

  2. In oTree set-up, configure the last page of the room to go back to your Sona system. See example return here. The URL to use would be similar to:
    "https://yourschool.sona-systems.com/webstudy_credit.aspx?experiment_id=123&credit_token=4e48f9b638a&survey_code=" + str(sona_id).

    In order to get an example of this URL, login to Sona and go to your Study information. Pull the client side URL from here:



    Remove the XXXX from the end of the above copied URL and use in the bolded area below. In oTree Studio, you might have a def vars_for_template(player) block of:

    sona_id = self.player.participant.label
    link = "https://yourschool.sona-systems.com/webstudy_credit.aspx?experiment_id=123&credit_token=4e48f9b638a&survey_code=" + str(sona_id)
    return{'link': link}
    

    Then the HTML Template block might have this to redirect to the above URL to grant credit:

    <meta http-equiv="Refresh" content="0; url='{{link}}'" />


This page is a reference post used in the creation of the above. These features are described on oTreeā€™s site at the following URL:

("Participant Labels") https://otree.readthedocs.io/ja/latest/admin.html?highlight=participant_label#participant-labels