控件自动埋点

EventCollection

简介:控件自动埋点
android 控件自动化埋点

控件点击事件埋点策略

  1. 埋点采用半自动化的方式进行,埋点的界面必须继承自 BaseActivity 或者 BaseFragment ,不含子控件的控件将会自动收集点击事件;
  2. 埋点统一收集类名+控件的 UI 目录树。
  3. 需要埋点包含子控件的 Layout 控件,在 .xml 布局文件中添加 android:tag 属性,否则将不会收集,此时子控件的点击事件将会被忽略。tag 的值统一以 click_event 开头。

例如:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:tag="click_event">

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@mipmap/ic_launcher" />

    </LinearLayout>

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Button" />

</LinearLayout>

Button 的点击事件将会自动收集,要收集 LinearLayout 的点击事件,此时必须设置 tag 属性,ImageView 的点击事件将不会再收集。

LinearLayout 的 UI 目录树为:MainActivity:DecorView[0]->LinearLayout[0]->FrameLayout[1]->LinearLayout[0]->LinearLayout[0];

Button 的 UI 目录树为:MainActivity:DecorView[0]->LinearLayout[0]->FrameLayout[1]->LinearLayout[0]->Button[1];

设备不同黑体部分的 UI 路径可能会有所不同

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值