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"