<input type="button" value="Start Timer" onclick="timeTracker._recordStartTime();"/>
<input type="button" value="Stop Timer" onclick="timeTracker._recordEndTime();"/>
<input type="button" value="Track!" onclick="timeTracker._track(pageTracker, Category, 'Manual Test');"/>
This is an internal event tracking code(using the action on click) and I would like to implement something similar like this that the "timeTracker._recordStartTime() starts when the page opened(loads) then "timeTracker._recordEndTime()" and "timeTracker._track(pageTracker, category, 'Manual Test') called when the user leaves the page(normally navigating away to another page).
my goal is to record the time spent on page as event and put in category with other events like on click JavaScript events.
How can I do this ?