Giter Club home page Giter Club logo

alog's Introduction

ALog

内容导航

##1. 概述 我们会使用或开发各种不同的统计模块对产品的使用情况进行收集,以便衡量产品的健康状况和对产品发展方向进行决策

随着前端交互越来越丰富,统计要分析的维度也越来越多样

经常一个页面中就会并行着多个统计模块:有性能相关的、有点击相关的、有业务相关的

ALog使用一些少量简单的API将这些复杂的统计模块统一组织起来

##2. ALog解决什么问题?

###2-1. 减少统计模块加载对产品的影响

ALog使用异步方式加载统计模块,不堵塞页面正常资源加载;

另外值得一提的是,ALog的模块文件不依赖加载顺序、兼容同步和异步加载。

###2-2. 并行多个统计模块

##3. ALog适合什么应用场景?

###3-1. 简单统计

直接这页面中调用

###3-2. 复杂统计

通过define定义统计模块

###3-3. 代理统计

接入第三方统计模块

##4. ALog入门

###4-1. 概念

###4-2. 准备工作

  • 页面加载的方式
<script>
void function(e,t,n,a,o,i,m){
e.alogObjectName=o,e[o]=e[o]||function(){(e[o].q=e[o].q||[]).push(arguments)},e[o].l=e[o].l||+new Date,i=t.createElement(n),i.async=!0,i.src=a,m=t.getElementsByTagName(n)[0],m.parentNode.insertBefore(i,m)
}(window,document,"script","http://uxrp.github.io/alog/dist/alog.min.js","alog");
</script>

##5. API文档

###5-1. ALog模块

####5-1-1. alog()

/**
 * 执行
 * @param{String} trackerMethod 追踪器的方法 "<trackerName>.<method>"
 * @param{Object…} params 方法
 */
function alog(trackerMethod, params)

####5-1-2. define()

alog('define', 'pv', function(){
   var pvTracker = alog.tracker('pv');
   pvTracker.set('ver', 1);
   pvTracker.set('px', window.screen.width + 'x' + window.screen.height);
   return pvTracker;
});

####5-1-3. require()

alog('require', ['pv'], function(pvTracker){
  pvTracker.create({
    postUrl: 'http://localhost/u.gif'
  });
});

####5-1-4. on()

绑定事件

function record(e){
 
}
alog('speed.on', 'record', function(e){
  var buffer = this.get('buffer');
  buffer.push('e');
});

####5-1-4. un()

注销事件

####5-1-5. fire()

派发事件

###5-2. ATracker模块

####5-2-1. create()

创建追踪器实例

alog('pv.create', {
  postUrl: 'http://localhost/u.gif'
});
alog('pv.send', 'pageview');

####5-2-1. set()

设置字段值

####5-2-2. get()

获取字段值

####5-2-3. send()

上报数据

####5-2-4. on()

绑定事件

####5-2-5. un()

注销事件

####5-2-6. fire()

派发事件

###5-3. 保留字段

####5-3-1. postUrl

上报地址

####5-3-2. protocolParameter

协议字段,用于简写

###5-4. 标准事件

####5-4-1. create

追踪器创建时触发

####5-4-2. send

数据上报时派发

##6. 参考文档

google analytics https://developers.google.com/analytics/devguides/platform/

alog's People

Contributors

johnyy avatar zhangjunah avatar zswang avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.