Automatic tracking of active time spent on each page.
Palace Tracker measures active time only — the timer pauses automatically when the tab becomes hidden (e.g. the user switches tabs or minimises the window) and resumes when they return. This gives a more accurate picture of genuine engagement than a simple page load to unload duration.
For SPAs, the timer resets on every route change, so each virtual page view is measured independently.
The page_exit event is fired when:
pagehide event)visibilitychange event)The tracker uses sendBeacon to ensure the event is delivered reliably even as the page is unloading. If a page is restored from the browser's back/forward cache, the timer resets and tracking starts fresh.
Time on page is included in the page_exit event alongside scroll depth:
{
"eventType": "page_exit",
"data": {
"duration": 45,
"maxScrollDepth": 87
}
}duration is the total active time in seconds, rounded to the nearest second.