Giter Site home page Giter Site logo

androidzhangyu / jjevent Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ccj659/jjevent

0.0 1.0 0.0 1.82 MB

stars:536 forks:34(,经过一段时间调整,重新开源) 一个经过充分测试和线上验证的Android客户端自定义数据埋点SDK

HTML 10.83% Java 89.17%

jjevent's Introduction

JJEvent 数据埋点SDK

License Author Platform

TO USE

1.SDK 服务启动

1.1 AndroidManifest.xml添加网络访问权限

 <uses-permission android:name="android.permission.INTERNET"/>
 <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

1.2 在application中初始化

public class App extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
        //在applicaition中 将宿主中取通用cookie
        JJEventManager.init(this,"cookie String");

    }
}

1.3 如果想进行事件统计,但是不想进行推送服务

/**
* 停止事件的上传任务(仍会记录事件,停止事件推送)
*/
JJEventManager.cancelEventPush();

1.4 如果想立刻停止所有sdk的事件服务.

/**
* 停止事件的上传任务(仍会记录事件,停止事件推送)
*/
JJEventManager.destoryEventService();

1.5 如果要进行参数设定,只需将1.2 中的代码改为如下即可.

    //
    //在applicaition中 将宿主中取通用cookie
        //JJEventManager.init(this,"s test=cookie String;",true);
            JJEventManager.Builder builder = new JJEventManager.Builder(getApplication());
                     builder.setHostCookie("s test=cookie String;")//cookie(1.只会初始化调用一次,后续上传不会再调用)
                             .setDebug(true)//是否是debug
                             .setSidPeriodMinutes(15)//sid改变周期
                             .setPushLimitMinutes(1)//多少分钟 push一次
                             .setPushLimitNum(100)//多少条 就主动进行push
                             .setCookieIntercept(new CookieFacade() {
                                 @Override
                                 public String getRequestCookies() { //宿主cookie通用参数 动态插入器(2.每次上传都会执行该方法,1.2两种取值方式,可按需选择一种)

                                     return getCookies();
                                 }
                             })
                             .start();//开始*/

2.统计操作

2.1 PV事件(屏幕值)操作

//方式1:无自定义参数
JJEvent.screen("Android/首页/列表", LTPType.SCREEN_LTP_REFRESH);

//方式2: 有自定义参数
Map ecp = new HashMap();
ecp.put("自定义key1", "自定义value1");
ecp.put("自定义key2", "自定义value2");
JJEvent.screen("Android/首页/列表", LTPType.SCREEN_LTP_REFRESH, ecp);

2.2 事件操作

//方式1: 无自定义参数
JJEvent.event("首页", "点击", "button");

//方式2: 添加自定义参数ecp
Map ecp = new HashMap();
ecp.put("自定义key1", "自定义value1");
ecp.put("自定义key2", "自定义value2");
JJEvent.event("首页", "点击", "button" , ecp);


2.3 事件曝光

//方式1: 无自定义参数
JJEvent.expose("首页", "曝光", "button");

//方式2: 添加自定义参数ecp
Map ecp = new HashMap();
ecp.put("自定义key1", "自定义value1");
ecp.put("自定义key2", "自定义value2");
JJEvent.expose("首页", "曝光", "button" , ecp);


ProGuard-rules

-keep class com.ccj.client.android.analytics.**{*;}
-keep class com.ccj.client.android.analytics.exception.**{*;}
-keep class com.ccj.client.android.analytics.enums.**{*;}

jjevent's People

Contributors

ccj659 avatar

Watchers

 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.