Calculating time spent on a page

Problem

You want to calculate how long someone has spent on a certain page.

Solution

There are two possibilities:

  • calculate the current time before the page and again after and store the difference;
  • activate BASEclicks.

Discussion

The first approach works well if you need only a few time counters or if you need to make reference to the time value within the questionnaire (e.g., to remind the respondent to take their time if they appear to be speeding through the questionnaire). It consists of adding two computed questions:

  • one before the page to be timed stores the current time in seconds; it may look like this:

    T1 CALCUL
    % question
       AT1 = time()
    % note
    % categories
     
    % skips
    % condition
    % open part
       1 = N10.0
    ! ==============================================================

  • a second computed question is placed after the page to be timed; it calculates and stores the difference in seconds between the current time and the time in AT1; it may look like this:

    T2 CALCUL
    % question
       AT2 = time() - $AT1
    % note
    % categories
     
    % skips
    % condition
    % open part
       1 = N10.0
    ! ==============================================================

The second approach uses BASEclicks. Once the BASEclick project is compiled and available, CallWeb systematically stores the time when each page is shown in each project which include the "# BASEclicks = yes" instruction; CallWeb also stores the time lapsed since the previous entry for a given IP address in a given project. The data in the BASEclicks project can be analyzed using any and all of the existing CallWeb utility programs. Beware of the fact that this project grows quite rapidly to many thousands of records on a busy server.

Calculating time spent on a page

Problem

You want to calculate how long someone has spent on a certain page.

Solution

There are two possibilities:

  • calculate the current time before the page and again after and store the difference;
  • activate BASEclicks.

Discussion

The first approach works well if you need only a few time counters or if you need to make reference to the time value within the questionnaire (e.g., to remind the respondent to take their time if they appear to be speeding through the questionnaire). It consists of adding two computed questions:

  • one before the page to be timed stores the current time in seconds; it may look like this:

    T1 CALCUL
    % question
       AT1 = time()
    % note
    % categories
     
    % skips
    % condition
    % open part
       1 = N10.0
    ! ==============================================================

  • a second computed question is placed after the page to be timed; it calculates and stores the difference in seconds between the current time and the time in AT1; it may look like this:

    T2 CALCUL
    % question
       AT2 = time() - $AT1
    % note
    % categories
     
    % skips
    % condition
    % open part
       1 = N10.0
    ! ==============================================================

The second approach uses BASEclicks. Once the BASEclick project is compiled and available, CallWeb systematically stores the time when each page is shown in each project which include the "# BASEclicks = yes" instruction; CallWeb also stores the time lapsed since the previous entry for a given IP address in a given project. The data in the BASEclicks project can be analyzed using any and all of the existing CallWeb utility programs. Beware of the fact that this project grows quite rapidly to many thousands of records on a busy server.