Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

Time spent by respondent to be embeded in a pass-through value at the end of the survey

Hi,

I am using Sawtooth platform and I would like to monitor the time spent by the respondent to fill in the questionnaire.
At the end of the survey, while completing the survey, the respondent is re-directed to a third-party platform using the terminate link.
I need to embed this data 'time spent to complete the questionnaire' as "pass-through' value. If I am not mistaken, there are pass-in fields to do that in Sawtooth.
However, I do not knowif there is a simple way to record the duration of the questionnaire (any existing variable) that could be defined as a pass-in field.

Many thanks in advance for your support,
asked Sep 20, 2016 by Rem (200 points)

1 Answer

0 votes
You can define a pass-in field (call it SurveyTime) as a whole number.

At the end of the survey, you can pop this script into the footer ...
[%SetValue(SurveyTime,(PageTime(1, 50)))%]

Note: PageTime(StartPage, EndPage) returns a value (in seconds) between StartPage and EndPage.

In the above example, I have assumed your survey starts at page 1 and ends at page 50. Change your EndPage accordingly. To determine your page numbers, go to the Write Questionnaire and click on any question. At the bottom of the screen, the page numbering will be displayed.

Now you have a variable called SurveyTime which has captured the interview length.

Pass the SurveyTime variable within your termination link as you would any variable like an ID.

Just one further tip - go to the Sawtooth Software HELP and look up the PageTime function. It tells you some handy information about the behaviour of this function.

Good luck.
answered Sep 20, 2016 by Paul Moon Platinum (57,565 points)
Very nice.  In addition to this, the TotalPages function can be used to future-proof this code in case any pages are added to the survey later.  A proof of concept:

https://www.google.com/#q=[% PageTime(1, TotalPages()) %]
And as the Sawtooth Software HELP suggests, you can apply arithmetic to avoid the hardcoding.

e.g. [%PageTime(PageNumber()-3, PageNumber())%]

Thank you SSI Script. Some great functions!!!
...