How to show overall duration time during survey | XM Community
Question

How to show overall duration time during survey

  • 10 July 2019
  • 7 replies
  • 458 views

Hello,

Can anyone help me with a css/javascript that will show the respondent how long he is busy with completing the survey? By that I mean a stopwatch that is counting up. I would like to have one that is there on every page from the beginning to the end of the survey. It would be fantastic if someone could help me! 🙂

Thanks in advance,
Danielle 🙂

7 replies

Userlevel 6
Badge +27
Hi!


i know you can do it, counting the time spent in each page using a timer question and setting it as displayed in the image below. However the timer resets everytime you move to the next page

!
Hi Ana,

Thank you for your answer! But I'm indeed looking for a timer that will be displayed during the whole survey.
Badge +2
Hi, Danielle,

We are fiddling with a similar issue. We decided to 1) add a Survey Flow Embedded Data element to the beginning of the survey. We called it StartedAt, and we used the Current Time value. Then 2) we customized our survey header to include both the embedded data field and also the Current Time variable. Now 3) every time someone goes to the next page the header refreshes. The StartedAt timestamp stays the same, but the Current Time value updates.

Screenshots attached.

!

!

!

It's not running time, but if they can do the simple math, they can figure it out 😀

Also, I'm sure there's already a systemField for the start timestamp, but this was a quick and dirty approach. Seems to work.
Userlevel 7
Badge +27
Danielle,

Add the following to your survey header:
1. Html similar to the following:
```
<div style="text-align:right">Timer: <span id="elapsedTime">0:00</span></div>
```
2. JS where you:
a. Pipe in Q_TotalDuration (the number of seconds since the start of the survey) as total seconds
b. Use a setInterval function to update the total seconds every second
c. Parse total seconds into HH:MM:SS format
d. Update the contents of the elapsedTime `<span>`.
Badge +4
TomG,
any docs on some code lines for the pipe?
this sounds like exactly what I want to do too...
Userlevel 7
Badge +27
> @hilli076 said:
> TomG,
> any docs on some code lines for the pipe?
> this sounds like exactly what I want to do too...

No, you'll have to write it.

Hello hilli076 , just wondering if you were able to do something like this. I have a timer displayed on one page (counting up), and would like it to continue when a participant continues on the next page. However, I'm not aware of the code that can make this work. Did you end up solving your problem?

Leave a Reply