umeng_statistics 1.0.4 copy "umeng_statistics: ^1.0.4" to clipboard
umeng_statistics: ^1.0.4 copied to clipboard

The plugin of Umeng statistics, The 1.0.0 version perfectly solves the problem of inaccurate statistics in Umeng.

example/lib/main.dart

import 'dart:collection';

import 'package:flutter/material.dart';
import 'dart:async';

import 'package:umeng_statistics/umeng_statistics.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
    initUmeng();
  }

  Future<void> initUmeng() async {
    UmengStatistics.initAppKey("601231686a2a470e8f909598", "6010fd6ff1eb4f3f9b73a145", "xxx",
        encryptEnabled: true);
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Umeng Analytics Plugin example'),
        ),
        body: Center(
          child: Column(
            children: [
              RaisedButton(
                onPressed: () {
                  Map<String, Object> data = HashMap();
                  data['tab1click'] = 1;
                  UmengStatistics.onEvent("UMEvent", data);
                },
                child: Text("事件统计"),
              ),
              RaisedButton(
                onPressed: () {
                  UmengStatistics.onProfileSignIn("1001");
                },
                child: Text("设置用户账户"),
              ),
              RaisedButton(
                onPressed: () {
                  UmengStatistics.onProfileSignOff();
                },
                child: Text("取消用户账户"),
              ),
              RaisedButton(
                onPressed: () {
                  UmengStatistics.setPageCollectionModeAuto();
                },
                child: Text("自动采集页面"),
              ),
              RaisedButton(
                onPressed: () {
                  UmengStatistics.setPageCollectionModeManual();
                },
                child: Text("手动采集页面"),
              ),
              RaisedButton(
                onPressed: () {
                  UmengStatistics.onPageStart("page1");
                },
                child: Text("页面时长统计开始"),
              ),
              RaisedButton(
                onPressed: () {
                  UmengStatistics.onPageStart("page2");
                },
                child: Text("页面时长统计结束"),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
4
likes
40
points
17
downloads

Publisher

unverified uploader

Weekly Downloads

The plugin of Umeng statistics, The 1.0.0 version perfectly solves the problem of inaccurate statistics in Umeng.

Homepage
Repository (GitHub)
View/report issues

License

BSD-2-Clause (license)

Dependencies

flutter

More

Packages that depend on umeng_statistics

Packages that implement umeng_statistics