oTree Forum >

Creating persistent links

#1 by anda

Hi there!

I'm fairly new to programming and I just programmed my first experiment with Otree.
To give you an idea of my experiment, two participants will play the game simultaneously in our lab but the game is not interactive. We will use the same two laptops for each of the pairs.

Until now, I used a session-wide link to start the experiment. However, I realized that this link sometimes changes. 

What would be the best option to create a persistent link that I can extract?

I appreciate any guidance!

#2 by BonnEconLab (edited )

Use a room. Rooms have persistent room-wide URLs, and you can determine that URL yourself in the settings.py file.

See https://otree.readthedocs.io/en/latest/rooms.html#creating-rooms.

The “name” attribute will become part of the URL.

#3 by anda

Thanks for your response!

I just created a room and saw this by the room-wide link:
"Here is the room-wide URL anyone can use. Don't use this link when testing in multiple tabs on the same browser, because all tabs will be assigned to the same participant, using a cookie. "

Could this be a problem for my experiment?

#4 by BonnEconLab

No, I don’t think so, as long as you are using separate laptops for the participants who are present at the same time.

Either way, you should try it out extensively before you invite participants ...

You can also always add “?participant_label=YOUR_IDENTIFIER_HERE” to the URLs.

For instance, you could use URLs of the type

http://xxx.xxx.xxx.xxx/room/NAME_OF_YOUR_ROOM/?participant_label=S01P01
http://xxx.xxx.xxx.xxx/room/NAME_OF_YOUR_ROOM/?participant_label=S01P02
http://xxx.xxx.xxx.xxx/room/NAME_OF_YOUR_ROOM/?participant_label=S01P03
http://xxx.xxx.xxx.xxx/room/NAME_OF_YOUR_ROOM/?participant_label=S01P04
...

for Session 1, Player 1, Player 2, Player 3, Player 4, etc., and then

http://xxx.xxx.xxx.xxx/room/NAME_OF_YOUR_ROOM/?participant_label=S02P01
http://xxx.xxx.xxx.xxx/room/NAME_OF_YOUR_ROOM/?participant_label=S02P02
http://xxx.xxx.xxx.xxx/room/NAME_OF_YOUR_ROOM/?participant_label=S02P03
http://xxx.xxx.xxx.xxx/room/NAME_OF_YOUR_ROOM/?participant_label=S02P04
...

for Session 2, Player 1, Player 2, Player 3, Player 4, etc.

Since the participant_label is stored by oTree in the database, this will uniquely identify each observation of yours.

You have to make sure, of course, that you do not use accidentally use a participant_label repeatedly.

#5 by anda

Thanks for your help! I will try that and of course test it first.

Cheers!

Write a reply

Set forum username