CLAUDE.md 1.1 KB

Statistics 模块

模块概述

Statistics 模块提供统计事件上报功能,支持用户行为统计、性能统计、业务统计等数据的收集和上报。

主要功能

  • 事件统计: 用户行为事件统计上报
  • 性能统计: 应用性能指标统计
  • 自定义统计: 业务自定义统计事件
  • 批量上报: 统计数据批量上报优化

核心接口

interface IStatistics {
    fun trackEvent(event: String, properties: Map<String, Any>)
    fun trackScreen(screenName: String, properties: Map<String, Any>)
    fun trackTiming(category: String, variable: String, time: Long)
    fun setUserProperty(key: String, value: Any)
}

使用方式

// 统计页面访问
Statistics.trackScreen("HomePage", mapOf(
    "user_id" to userId,
    "timestamp" to System.currentTimeMillis()
))

// 统计用户行为
Statistics.trackEvent("button_click", mapOf(
    "button_name" to "login",
    "screen_name" to "LoginPage"
))

// 统计性能指标
Statistics.trackTiming("network", "api_call", responseTime)

构建配置

implementation "com.wenext.android:frame-statistics:6.0.0"