点评Android App埋点总结

下面是点评android埋点的学习总结。

简介

点评App有一套称为Judas自动化打点的框架,来实现埋点需求。这套框架,确实方便了PM的数据分析要求与RD的埋点上报实现。

http://nugget.data.dp/assets/html/index.html#/ 这是埋点查询平台,在这里可以查询到具体页面、具体模块的埋点定义情况,还能方便PM修改或新增各种埋点,如下图所示:

新增 或者 修改 埋点时,可以选择埋点上报类型,这里有5种,其实看代码主要是展现、点击、滑动,前两种比较常见。还可以选择上报哪些信息,这里也是有限制的,如下:

Judas上报日志规范 这里对上报规范作了简要介绍。

在这个平台定义好埋点,然后RD根据要求实现,实现后可在mock工具http://appmock.dp中查看上报信息。

折叠原码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
public  class  GAUserInfo  implements  Cloneable {
     /**
      * 搜索ID
      */
     public  String query_id =  null ;
     /**
      * 排序方式
      */
     public  Integer sort_id =  null ;
     /**
      * 搜索关键字
      */
     public  String keyword =  null ;
     /**
      * 团购单id
      */
     public  Integer dealgroup_id =  null ;
     /**
      * 团购套餐id
      */
     public  Integer deal_id =  null ;
     /**
      * 分类id
      */
     public  Integer category_id =  null ;
     /**
      * 劵id
      */
     public  Integer receipt_id =  null ;
     /**
      * 订单id
      */
     public  Integer order_id =  null ;
     /**
      * 商圈id
      */
     public  Integer region_id =  null ;
     /**
      * 优惠劵id
      */
     public  Integer promo_id =  null ;
     /**
      * 签到id
      */
     public  Integer checkin_id =  null ;
     /**
      * 预定id
      */
     public  Integer book_id =  null ;
     /**
      * 会员卡id
      */
     public  Integer member_card_id =  null ;
     /**
      * 活动标识
      */
     public  String utm =  null ;
     /**
      * 商户id
      */
     public  Integer shop_id =  null ;
     /**
      * 点评id
      */
     public  Integer review_id =  null ;
     /**
      * 位置信息
      */
     public  Integer index =  null ;
     /**
      * 业务部门标签
      */
     public  Integer butag =  null ;
     /**
      * url
      */
     public  String url =  null ;
     /**
      * title
      */
     public  String title =  null ;
 
     /**
      * 外部吊起接口
      */
     public  String marketing_source =  null ;
 
     /**
      * 广告id
      */
     public  String ad_id =  null ;
 
     /**
      * 商务id
      */
     public  String biz_id =  null ;
 
     /**
      * 备用int值
      */
     public  Integer sectionIndex =  null ;
 
     /**
      * 订单信息
      * 格式为 orderid1#productcode1|orderid2#productcode2
      * 兼容单个orderid和productcode
      */
     public  String prepay_info =  null ;
 
     @Override
     public  Object clone() {
         // 浅拷贝
         try  {
             // 直接调用父类的clone()方法
             return  super .clone();
         catch  (CloneNotSupportedException e) {
             return  null ;
         }
     }
}

如何使用

具体使用原理见基本思路。

View的埋点

1)点击埋点

继承点评自带的NovaXXX控件,调用setGAString()方法,针对要上报的个性化信息,可以通过GAUserInfo携带。

例如:

private GAUserInfo gaExtra = new GAUserInfo();
GAUserInfo gaExtraClone = (GAUserInfo) gaExtra.clone();
gaExtraClone.dealgroup_id = (int) deal.dpgroupid;
tempHolder.setGAString("shike", gaExtraClone);

针对GAUserInfo的创建:可以像上方一样新建;若是Agent,可以调用getGAExtra();若是Activity,可以调用getCloneUserInfo()。

2)其他埋点,例如展现 ----注意,这里手动调用埋点工具时,最好在此模块真的有数据时,再调用,否则会出现只要这个页面初始化了这个模块,就上报埋点,导致View被隐藏时也会上报

(1)contextStatisticsEvent(Context context, String elementId, String title, int index,String action) 

(2)contextStatisticsEvent(Context context, String elementId, GAUserInfo gaUserInfo, String action)   

(3)statisticsEvent(View view, String action)  

(4)addGAView(DPActivity dpActivity, final View view, final int index, final String pagename, final boolean show)

例如: 

GAHelper.instance().contextStatisticsEvent(getContext(), "shike", null, GAHelper.ACTION_VIEW);

3)listView打点需list本身继承NovaListView,并且单独设置每个ListItem的属性。

页面埋点

Android底层基类已经完成绝大多数页面事件的收集和上报,如特殊界面则可以复写此方法:

protected void onNewGAPager(GAUserInfo userInfo) {}

在其中可设置setGAPageName()、setRequestId()等。

例如:

public  class  FoodIndexActivity  extends  FoodPoiListActivity {
     @Override
     public  NovaFragment[] getFragments() {
         return  new  NovaFragment[]{ new  FoodIndexFragment()};
     }
 
     @Override
     public  String getPageName() {
         return  "meishi_home" ;
     }
 
     @Override
     protected  void  onNewGAPager(GAUserInfo userInfo) {
         GAUserInfo gaUserInfo = userInfo;
         if  (gaUserInfo ==  null ) {
             gaUserInfo =  new  GAUserInfo();
         }
         GAHelper.instance().setGAPageName(getPageName());
         GAHelper.instance().setRequestId( this , UUID.randomUUID().toString(), gaUserInfo,
                 false );
     }
}
说明
  • PV上报时机:

     

    每当展示一次界面就上报一次PV
    从其他界面back到该界面
    新建一个界面/网页
    切换一个新的tab或者page
    list下拉到一个新的请求

     

  • 一个页面中非PV元素一般只打一次点
    View的展现是进入当前页面只要存在此View就上报,并不是出现在视野前上报,而且从其他页面返回到当前页面不会上报。
    另外,注意埋点方法的调用地点,它不管view的可见性Visibility。


  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值