Response times in milliseconds

136 views
Skip to first unread message

Kam

unread,
Apr 26, 2022, 3:26:34 PM4/26/22
to oTree help & discussion
Hello,

For my app I need to get data on how much time the user spent on each page. I used the information on https://otree.readthedocs.io/en/latest/admin.html#export-data to get that, and it works well. However, it only shows how many seconds the user spent on each page. I need data with more precision: the number of milliseconds or seconds with a couple of decimal digits.

I'm not sure how to modify the "pagetimes.py" script (https://otree.readthedocs.io/en/latest/_downloads/d4f9f0315d093284dedcf1c2e66e7c68/pagetimes.py) to reflect that.

Any help is much appreciated.
Kam

Chris @ oTree

unread,
Apr 26, 2022, 11:43:17 PM4/26/22
to Kam, oTree help & discussion
For millisecond precision, you would need to record that in JavaScript code. Use performance.now() and you can send these timestamps to the server with liveSend.

pagetimes.py only gives you approximate times, because it is affected by server latency.

Sent from my phone

On Apr 27, 2022, at 5:26 AM, Kam <mr.k...@gmail.com> wrote:

Hello,
--
You received this message because you are subscribed to the Google Groups "oTree help & discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to otree+un...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/otree/83ab950c-9f1c-44e6-8fcc-bfad797b4843n%40googlegroups.com.

Kam

unread,
May 23, 2022, 7:32:11 PM5/23/22
to oTree help & discussion
Thanks. I have set up the time variables in Player(BasePlayer) as well as in MyPage(Page) classes. I also set up the hidden button in the html codes to be connected to liveSend. However, I'm not sure about what to code in the Block Scripts section of the html (the Javascript part). Any help with that would be much appreciated.
Reply all
Reply to author
Forward
0 new messages