<html>
<head>
<title>Latency Tracking Demo</title>
</head>
<body>
<script type="text/javascript" src="http://www.google-analytics.com/ga.js"></script>
<script type="text/javascript" src="http://www.example.com/scripts/time-tracker.js"></script>
<script type="text/javascript">
var timeTracker = new TimeTracker();
var pageTracker = _gat._getTracker('UA-1735986-1');
</script>
<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, undefined, 'Manual Test');"/>
</body>
</html>
我正在尝试将此概念应用于 onload JavaScript 事件作为 Start Time 和 onunload 作为 Stop time ,例如
onload="timeTracker._recordStartTime();"
onunload="timeTracker._recordEndTime(); timeTracker._track(pageTracker, 'Category','Action');"
但是没有得到它的工作..甚至没有抛出错误
任何的想法