cux_analytics_sdk 0.0.24
cux_analytics_sdk: ^0.0.24 copied to clipboard
This is an analytics SDK from CUX.io
Features #
The CUX Analytics SDK integrates with Flutter (Android and iOs) applications to automatically detect user activities. With the addition of a few lines of code you can monitor and analyze your entire application to understand how the user uses it. The result of such monitoring is presented on CUX Analytics Dashboard.
Getting started #
In order to use the CUX Analytics SDK you first need to create a CUX account: https://app.cux.io
Usage #
For Android check internet permission
void main() {
print("CuxSDK: main()");
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
print("CuxSDK: MyApp build()");
CuxAnalytics.init(
context, '1428112091.0.46456300.1480349278.583c565e0fc5d');
return AnalyticsWidget(
child: MaterialApp(
title: 'Flutter CUX Demo',
...
home: const HomeWidget(),
navigatorObservers: [
CuxAnalytics.createNavigationObserver(context, this)
],
),
);
}
}
If you need to approve collecting user’s data you can init disabled SDK and start collecting data after the confirmation that collecting data are allowed:
CuxAnalytics.init(context, {token}, needConfirmToStart: true);
CuxAnalytics.resumeCollectingData();
If you use go_router add RouterNavigationListener:
@override
Widget build(BuildContext context) {
return MaterialApp.router(
routerConfig: _router,
debugShowCheckedModeBanner: false,
onNavigationNotification:
RouterNavigationListener(rootWidget: this).onNavigationNotification,
);
}
If pages in your app are not MaterialApp or Scaffolds then for better navigation observability wrap widgets of your screens in DestinationWidget with unik destination name:
@override
Widget build(BuildContext context) {
return DestinationWidget(
destinationName: "Destination_$name",
child: Column(...
Additionally you can mask some parts of your screens that contain sensitive information. Best practice for masking: always mask not just only sensitive information but some bigger part of screen, especially if this is a scrollable screen.
import 'package:cux_analytics_sdk/masking_widget.dart';
MaskingWidget(
child: Padding(
padding: EdgeInsets.all(16.0),
child: Text('Masked text'),
)),
You can stop collecting data at any moment:
CuxAnalytics.stopCollectingData();
You can resume collecting data if you inited disabled SDK or if you stopped data:
CuxAnalytics.resumeCollectingData();
Additional information #
This is an SDK for Android and iOs Flutter apps.
You can monitor such data:
- Activities and Fragments opening with class names and arguments;
- Screen size, screen rotation;
- Clicks on clickable and long clickable elements, selection of checkable elements, scrolls, touches;
- Android system, device and network parameters;
- Keyboard opening and closing.
- This list will be expanded in the next versions of SDK.
All data are presented on CUX Dashboard in Visits and HeatMaps etc. https://help.cux.io/support/solutions/articles/103000320480-flutter