使用Google analytic
<input type="submit" id="btnTrack" value="Submit!" onclick="timeTracker._recordEndTime(); return timeTracker._track(pageTracker, undefined, 'Buni'); " />
我正在使用两个函数,在这种情况下,我首先要执行timeTracker._recordEndTime()
然后timeTracker._track(pageTracker, undefined, 'Buni')
,但我没有得到预期值
这是我基于
的想法<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>
答案 0 :(得分:-2)
它只支持单个语句,而不是多个语句,试试这个:
onclick="javascript:(function () { /* try put your multiple statements here. */ })()"