Moodle and time variables

I am using Moodle as an LMS, and need to be able to track how long each user is on each page within a course built in lectora, and the total time they are within the course. I'm sure this needs to be done via variables, but am not sure how to accomplish it.



If I understand it correctly AICC_Time is what is going to hold the total time that the user is in the course. I also need to be able to stop the timer if the user is idle for too long.



Basically, I need to be able to report on how long each user has been on each page or test question, and the total amount of time they have been in the course.



Any guidance will be very much appreciated.