All Projects → flmn → umeng_analytics_plugin

flmn / umeng_analytics_plugin

Licence: MIT license
Flutter 版友盟统计插件

Programming Languages

java
68154 projects - #9 most used programming language
ruby
36898 projects - #4 most used programming language
dart
5743 projects
objective c
16641 projects - #2 most used programming language
swift
15916 projects

Projects that are alternatives of or similar to umeng analytics plugin

flutter ume
UME is an in-app debug kits platform for Flutter. Produced by Flutter Infra team of ByteDance
Stars: ✭ 1,792 (+8860%)
Mutual labels:  flutter-plugin
stop watch timer
This is Stop Watch Timer for flutter plugin.🏃‍♂️
Stars: ✭ 76 (+280%)
Mutual labels:  flutter-plugin
expanding bottom bar
BottomNavigationBar for Flutter with expanding titles
Stars: ✭ 39 (+95%)
Mutual labels:  flutter-plugin
Flutter-Mobile-Number-Plugin
Flutter Plugin to get the mobile number
Stars: ✭ 22 (+10%)
Mutual labels:  flutter-plugin
nearby connections
Flutter plugin (android) for sharing bytes and files Offline, (Based on the android Nearby Connections API)
Stars: ✭ 64 (+220%)
Mutual labels:  flutter-plugin
umeng analytics push
Umeng Analytics&Push Flutter Plugins
Stars: ✭ 28 (+40%)
Mutual labels:  umeng
flutter cameraview
A Flutter plugin for Android and iOS allowing access to the device cameras, a bit deeper!!
Stars: ✭ 18 (-10%)
Mutual labels:  flutter-plugin
flutter-app
Full Feature Todos Flutter Mobile app with fireStore integration.
Stars: ✭ 138 (+590%)
Mutual labels:  flutter-plugin
barcode.flutter
barcode generate library for Flutter
Stars: ✭ 58 (+190%)
Mutual labels:  flutter-plugin
Some-Calendar
Custom calendar dialog widget for flutter with (multi select, single select, date range) mode
Stars: ✭ 69 (+245%)
Mutual labels:  flutter-plugin
material-about
An about screen to use in your Mobile apps.
Stars: ✭ 37 (+85%)
Mutual labels:  flutter-plugin
flutter easyloading
✨A clean and lightweight loading/toast widget for Flutter, easy to use without context, support iOS、Android and Web
Stars: ✭ 1,021 (+5005%)
Mutual labels:  flutter-plugin
gbk2utf8
A flutter package to convert gbk to utf-8
Stars: ✭ 40 (+100%)
Mutual labels:  flutter-plugin
flutter-scankit
Flutter QR code scanning
Stars: ✭ 107 (+435%)
Mutual labels:  flutter-plugin
twilio flutter
A Flutter package for Twilio API.
Stars: ✭ 16 (-20%)
Mutual labels:  flutter-plugin
scalable image
A widget that shows an image which can be scaled and dragged using gestures.
Stars: ✭ 15 (-25%)
Mutual labels:  flutter-plugin
getx-snippets-intelliJ
An extension to accelerate the process of developing applications with flutter, aimed at everyone using the GetX package.
Stars: ✭ 52 (+160%)
Mutual labels:  flutter-plugin
seo renderer
A Flutter Web Plugin to display Text Widget as Html for SEO purpose
Stars: ✭ 103 (+415%)
Mutual labels:  flutter-plugin
Vertical Card Pager
Use dynamic and beautiful card view pagers to help you create great apps.
Stars: ✭ 84 (+320%)
Mutual labels:  flutter-plugin
getwidget-docs
Get Widgets UI library docs.
Stars: ✭ 17 (-15%)
Mutual labels:  flutter-plugin

umeng_analytics_plugin

Flutter 版友盟统计插件。

公众号文章:Flutter 集成友盟统计

基础使用

代码可参考 example。

初始化

https://www.umeng.com/ 申请 Android 和 iOS 的appKey。调用 init 方法初始化。

await UMengAnalyticsPlugin.init(
    androidKey: '5dfc5b91cb23d26df0000a90',
    iosKey: '5dfc5c034ca35748d1000c4c',
);

页面开始和结束

UMengAnalyticsPlugin.pageStart('page');
UMengAnalyticsPlugin.pageEnd('page');

自定义事件

UMengAnalyticsPlugin.event('event');

自动收集页面事件

这种方式只能收集 Navigator 的 push 和 pop 动作,程序自己控制的页面转换,需要手工处理。

使用 AppAnalysis 类监听导航

MaterialApp(
    ...
    onGenerateRoute: Router.generateRoute,
    navigatorObservers: [AppAnalysis()],
    ...
)

AppAnalysis 类参考代码

class AppAnalysis extends NavigatorObserver {
  @override
  void didPush(Route<dynamic> route, Route<dynamic> previousRoute) {
    if (previousRoute.settings.name != null) {
      UMengAnalyticsPlugin.pageEnd(previousRoute.settings.name);
    }

    if (route.settings.name != null) {
      UMengAnalyticsPlugin.pageStart(route.settings.name);
    }
  }

  @override
  void didPop(Route<dynamic> route, Route<dynamic> previousRoute) {
    if (route.settings.name != null) {
      UMengAnalyticsPlugin.pageEnd(route.settings.name);
    }

    if (previousRoute.settings.name != null) {
      UMengAnalyticsPlugin.pageStart(previousRoute.settings.name);
    }
  }

  @override
  void didReplace({Route<dynamic> newRoute, Route<dynamic> oldRoute}) {
    if (oldRoute.settings.name != null) {
      UMengAnalyticsPlugin.pageEnd(oldRoute.settings.name);
    }
    
    if (newRoute.settings.name != null) {
      UMengAnalyticsPlugin.pageStart(newRoute.settings.name);
    }
  }
}

记得设置 route name,否则 route.settings.name 取出为空,例如:

MaterialPageRoute(
  settings: RouteSettings(name: RouteNames.XXX),
  builder: (context) => XxxView(),
);
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].