找了半天,网上竟然没有一个google页面内部统计,完整的例子。下面举二种简单用法,js可以自己封闭。
1,
<html> <head> <script type="text/javascript" src="http://www.google-analytics.com/ga.js"></script> <script> var pageTracker = _gat._getTracker("UA-41400096-1") </script> </head> <body> <a href="#" onClick="pageTracker._trackEvent('test', 'click');">test</a> </body> </html>
2,
<html> <head> <script type="text/javascript" src="http://www.google-analytics.com/ga.js"></script> <script> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-41400096-1']); _gaq.push(['_trackPageview']); </script> </head> <body> <a href="#" onClick="_gaq.push(['_trackEvent', 'test', 'click'])">test</a> </body> </html>
转载请注明
作者:海底苍鹰
地址:http://blog.51yip.com/google/1536.html