How to check actual time of interaction of user with form while submitting a record in session

Priya3696
Tera Contributor

Hi Team,

 

I want to calculate the actual time partner is spending while filling the form and submitting the record on service portal. I want to exclude the time if partner spending on other activity ex. having tea during submitting record.

 

Any help will be appriciated.

 

3 REPLIES 3

Priya3696
Tera Contributor

Can anyone reply here?

Hello @Priya3696 ,

I feel this requirement is very silly, that's my opinion. However, I can help you with the design.

Please find below things to write your javascript code :

  1. Record the timestamp when a partner opens the form.
  2. Use JavaScript events to detect partner activity such as keystrokes, mouse movements, scrolling etc. Start a timer that resets on each of these events.
  3. If no activity is detected for a given period (say 5 minutes), assume that the partner is inactive and stop the timer.
  4. When activity resumes, start the timer again.
  5. Record the timestamp when they submit the form and subtract any idle time from the total elapsed time.


Hope this helps.

Regards,

Amarjeet Pal

Priya3696
Tera Contributor

@Amarjeet Pal , I am trying to implement below code in widget client script but its not working, 

 
  var sw = new StopWatch();
  
 if (document.hasFocus()) {
  
   if (navigator.userActivation.isActive) {
     
     sw.restart();
    
     console.log("Partner started interacting "+sw.getTime());
   }
   
    
 } else {
   sw.stop();
console.log("Partner ended interacting at time: "+sw.getTime());
 //   text = "The document does NOT have focus.";
  }
 
 
can you please help if I'm missing something.