djangoflow_analytics

Creator: coderz1093

Last updated:

0 purchases

djangoflow_analytics Image
djangoflow_analytics Images

Languages

Categories

Add to Cart

Description:

djangoflow analytics

djangoflow_analytics #
djangoflow_analytics is a library for tracking analytics with multiple Analytics providers in Flutter applications. It is built on top of analytics package.
Installation #
To use this library in your project, add the following dependency to your pubspec.yaml file:
dependencies:
djangoflow_analytics: <latest_version>
analytics: <latest_version>
copied to clipboard
Then run flutter pub get to install it.
Usage #
Initialization #
Before sending any data, the library must be initialized by calling the init method on the DjangoflowAnalytics class. It comes in handy if you want to disable sending analytics in specific cases like development environment.
DjangoflowAnalytics.instance.init();
copied to clipboard
Adding Performers #
To handle the data that is sent, you can create a class by exnteding AnalyticActionPerformer and add them to the DjangoflowAnalytics class.
abstract class CustomAnalyticsAction implements AnalyticAction, HasKey, HasMapParams {}

class CustomLoginEvent extends CustomAnalyticsAction {
final String? method;

CustomLoginEvent({this.method});
@override
String get key => 'login';

@override
Map<String, Object?> get params => {
'method': method,
};
}


class CustomAnalyticActionPerformer extends AnalyticsActionPerformer<CustomAnalyticsAction>{
...
}

final performer = CustomAnalyticActionPerformer<CustomAnalyticAction>(); // could be firebase, facebook etc.
DjangoflowAnalytics.instance.addAllActionPerformers([performer]);
copied to clipboard
Sending Data #
To send data, you can create an instance of AnalyticAction and pass it to the performAction method on the DjangoflowAnalytics class. It will internally look for suitable ActionPerformer for the AnalyticsAction and send the data.
DjangoflowAnalytics.instance.performAction(CustomLoginEvent(method:'email'));
copied to clipboard
Event Trimmer #
It also provide a way to trim events by implementing EventTrimmer interface which has 4 methods, trimName, trimValue, trimNullValueMapParams and trimMapParams.
User property trimmer #
It also provide a way to trim user property by implementing UserPropertyTrimmer interface which has 2 methods, trimName and trimValue.
Example #
import 'package:djangoflow_analytics/djangoflow_analytics.dart';

class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
DjangoflowAnalytics.instance.init();
final performer = CustomAnalyticActionPerformer<CustomAnalyticAction>();
DjangoflowAnalytics.instance
.addAllActionPerformers([performer]);
return MaterialApp(
home: Scaffold(
body: Center(
child: RaisedButton(
child: Text("Email Sign-in"),
onPressed: () {
DjangoflowAnalytics.instance
.performAction(CustomLoginEvent(method:'email'));
},
),
),
),
);
}
}
copied to clipboard
Note #
This library is still under development and may be subject to breaking changes.
Contributions #
We would love to have your contributions. Please feel free to open an issue or pull request.

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.