oTree Help PageJoseph Orr2022-08-15T23:52:33+00:00
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):
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: https://otree.yourschool.edu/room/my_room_name/ then change it to https://otree.yourschool.edu/room/my_room_name/?participant_label=%SURVEY_CODE%
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)
Then the HTML Template block might have this to redirect to the above URL to grant credit: