rangers_app_log 4.0.0
rangers_app_log: ^4.0.0 copied to clipboard
RangersAppLog的Flutter插件。支持埋点上报。
rangers_app_log #
RangersAppLog 的 Flutter 埋点插件,支持 Android 和 iOS。
For the global version, use the
globalbranch.
环境要求 #
- Flutter 3.41.0 或更高版本
- Dart 3.11.0 或更高版本
- iOS 13.0 或更高版本
- iOS App 必须使用
UIScene生命周期
4.0.0 起不再兼容旧的 iOS AppDelegate UI 生命周期。Flutter 3.41 默认支持
UIScene;如果 App 自定义过 AppDelegate,请按
Flutter UIScene 迁移指南
完成迁移。
安装 #
dependencies:
rangers_app_log: ^4.0.0
Android 项目需要在仓库配置中加入巨量引擎 Maven 仓库:
maven {
url 'https://artifact.bytedance.com/repository/Volcengine/'
}
使用 #
import 'package:rangers_app_log/rangers_app_log.dart';
final rangersAppLog = RangersAppLog();
Future<void> initializeAnalytics() async {
await rangersAppLog.init(showDebugLog: false);
}
Future<void> reportClick() async {
await rangersAppLog.onClick(
eventName: 'product_click',
params: {'productId': 'abc123'},
);
}
Future<void> reportRegister() async {
await rangersAppLog.onEventRegister(registerWay: 'wechat');
}
Future<void> reportPurchase() async {
await rangersAppLog.onEventPurchaseonEventPurchase(
commodityType: 'gift',
tradeName: 'flower',
productId: '008',
productCount: 1,
payWay: 'wechat',
payCurrency: 'CNY',
paySuccess: true,
payMoney: 100,
);
}
完整示例见 example/lib/main.dart。
更多 Rangers 相关资料请参考 Rangers 官网。