Page level and cumulative session timer

Silver Contributor
Silver Contributor

I have a javascript timer running on each of my pages that sends a ping and increments every 10 seconds. E.g. 10, 20, 30 , 40 etc. I want to pass this value to the next page and continue to increment. Any best practices or suggestions on how to easily do this. I want to have two variables a page time variable and a cumulative session time variable. It should look something like this.

 

              Page time       Cumulative time

page a         10                    10

page a         20                    20

page b         10                    30

page c         10                    40

 

1 REPLY 1

Page level and cumulative session timer

Employee Emeritus

Hello @joecbrown. In order to accomplish this you would need to leverage cookie or sessionstorage for each page. When the page initially loads in, you would want to write some custom JS that would verify if your interval is actually running at that point. If it isn't, you would then look at the data that had been persisted in the local storage, utilize that data for the incrementing storage, and then begin your interval again. 

Public