Skip to content

Instantly share code, notes, and snippets.

@naoyeye
Created December 3, 2015 11:12
Show Gist options
  • Save naoyeye/86a8bd75b7e866f4c9c9 to your computer and use it in GitHub Desktop.
Save naoyeye/86a8bd75b7e866f4c9c9 to your computer and use it in GitHub Desktop.
// html 中引入 ga
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','//static.wdjimg.com/misc/javascripts/analytics.js','ga');ga('create', 'UA-15790641-69', 'auto');
// 把 pageview 放到 js 中
ga('send', 'pageview');
// 用户触发动作时,js 中记录示例
ga('send', 'event', 'yilan', 'share', 'wechat-timeline');
ga('send', 'event', 'yilan', 'install', '这里写对应的包名');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment