When one shows a page, timers are in context of that page. When one navigates to a new page at the site, all logic that was previously running in the existing page is brought to a halt and the new page loaded.
For example, if you were looking at www.google.com and then went to www.bing.com, you would not want google to still be able to run logic in bing. The same holds true for navigating between pages at the same site (same domain). When a browser loads a page from a site navigating (normally) to another page tares down all logic in the original page.
One possible solution would be have an iframe covering your page and your navigation happens within the iframe. Then outside of the iframe would be one page and would be able to maintain context and code execution for the time spent at the site.
An alternate solution might be to maintain state in either cookies or localStorage and when each new page is reached, it could look at the previously saved values. This would mean that your timer would have to run on each page but could use the "site" stateful values to know for how long to pause.