google tracking

2011年3月27日 星期日 by Hu, Ching-Hsiang

in html

<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-xxxxxxxx-x']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
function GAPageView(url){_gaq.push(['_trackPageview', url]);}
function GAEventTrack(category, action, label){_gaq.push(['_trackEvent', category, action, label]);}
</script>


in as

tracking page view
GATracking.trackPageview("/index");

tracking event
GATracking.trackEvent("/index", "action", "做了啥");


GATracking.as -> author jacky

Filed under having  

0 意見: