Git Product home page Git Product logo

dcagent's Introduction

DCAgent

Build Status codecov.io

an analytics sdk for HTML5 app and web game

Requirements

  • XMLHttpRequest / XDomainRequest (for ajax request)
  • localStorage
  • ECMAScript 5

If uid is supplied on sdk's initialization, localStorage is optional. But you may lost some data when players leave.

Environment support

  • Web browser including WebView
  • Node.js
  • Egret Engine
  • Cocos2d-js
  • layabox

Usage

In browser (recommed!)

<script id="sample_code">
  /* jshint ignore:start */
  ;(function(b,f){
    var a=document.createElement("script");a.async=true;a.charset="UTF-8";a.src=f;var d=document.querySelector("script");d.parentNode.insertBefore(a,d);var e=[];var c=function(h){if(typeof DCAgent==="undefined"){e.push(arguments)}else{var g=DCAgent[h];if(!g){return console.log("DCAgent."+h+" is undefined")}if(typeof g==="function"){return g.apply(DCAgent,[].slice.call(arguments,1))}else{return g}}};c.loadTime=Date.now();c.cache=e;window[b]=c;window["DCAgentObject"]=b
  })("dc", "../dist/dcagent.v2.src.js");
  // 修改为SDK脚本所在路径

  // 初始化
  dc('init', {
    // APPID
    appId: 'c4bd90a91fe340aae1ecb1852d1d12e8',
    // 渠道名
    channel: 'wexin',
    // 打开错误日志上报,默认关闭
    errorReport: true
    // 其他配置参数参考 http://wiki.dataeye.com/h5/document/html5/api.html#init
  });
</script>

In Egret Runtime

DCAgent.init({
  // APPID
  appId: 'c4bd90a91fe340aae1ecb1852d1d12e8',
  // 渠道名
  channel: 'wexin',
  // 打开错误日志上报,默认关闭
  errorReport: true
  // 其他配置参数参考 http://wiki.dataeye.com/h5/document/html5/api.html#init
})

Unit test

in Node.js

npm test

in browser

npm run demo

Open http://localhost:8000/example/index.v2.html in chrome.

Some test suites may fail on Firefox / Safari, because of the implementation of localStorage.

Build

npm install
gulp

Start guide

http://wiki.dataeye.com/h5/document/html5/guide.html

API docs

http://wiki.dataeye.com/h5/document/html5/api.html

Egret integration

http://wiki.dataeye.com/h5/document/html5/egret.html

dcagent's People

Contributors

sizappaaigwat avatar

Stargazers

name_unknow_401111 avatar spcent avatar  avatar Mr、z avatar  avatar Chengji Cao avatar Thinking80s avatar  avatar finscn avatar

Watchers

finscn avatar James Cloos avatar spcent avatar

Forkers

zhengqiangzi

dcagent's Issues

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.