eLBX Online 2021 | June 22 - 24

Join us for a FREE, 3-day virtual conference featuring industry experts and eLearning thought leaders. Learn about critical topics such as eLearning accessibility, learning experience design, course authoring, virtual reality, and gamification. Register today!

Time on page?

joejubee Community Member Posts: 321 ✶ Headliner ✶
Is there a way to get a time on page into a variable? (Not the time of day, a timer that counts up from 1 second, to whatever)

I was thinking of some action that started a timer, and when the user hit the next button, the contents of that timer would get written into a variable.





  • jvalley4735
    jvalley4735 Community Member Posts: 1,357
    Progress bars can be converted into timers.  Then you can say when the time was up collect the data entered in so far....

  • joejubee
    joejubee Community Member Posts: 321 ✶ Headliner ✶
    Ok - looking at the timer component of the progress bar, that seems like more of a count-down type timer.

    I'm looking for something that as soon as you hit the page, it starts counting up to an infinite number. Then, when you leave that page, the number gets set as a variable, and the count-up resets.

    But we're getting closer. :-)

  • jvalley4735
    jvalley4735 Community Member Posts: 1,357
    You could reverse the numbering system so it would appear to be counting up instead of down? Or you could create a text block that changes contents every second but that would have to involve a lot of actions to keep the development within Lectora. I think th easiest way is for something to be coded in (div.time maybe?)

    @mnotermans5114 - Do you have any suggestions?
  • timk
    timk Community Member Posts: 1,180 ☆ Superstar ☆
    The progress bar timer is counting up and it has its own variable, containing the time. It can be started On:Page show and paused at any time.

    The timer object can count up or down, but its variable cannot easily be used. It can be played or paused, but it requires javascript to get the current value.

    You can build your own timer, by adding an action to the page:

    On: Timed interval
    Interval: 1 second
    Action: Modify variable
    Target: MyTimer
    Type: Add to variable
    Value: 1

    You can use a second variable to play or pause this timer, MyTimer will contain the time on the page in seconds.

  • mnotermans5114
    mnotermans5114 Community Member Posts: 916
    I do think Tim's suggestion building a custom timer is the best way to go.

    You could create a timed action that countsup a variable at every second or any other interval. That would stop when going to the next page. The next page you however either need another variable, because i presume you want to addup all time spent on pages on the end of the course and get a total. If thats the case you might want to check the build in timers...they run over subsequent pages and thus can hold your total time.


  • joejubee
    joejubee Community Member Posts: 321 ✶ Headliner ✶
    Awesome! That totally works. Our reporting tool reports the total time in the course, but we're interested in the total time spent on each page, and I think this will do it.

    Thanks for all the help!

Sign In or Register to comment.

So You Wanna Be An eLearning ROCKSTAR?

We're all fans of eLearning here! Want to become an eLearning ROCKSTAR? Just click on one of the buttons below to start your rocking journey!