analytics
분석 서비스 작업을 위한 인터페이스입니다. 이 라이브러리는 다양한 분석 서비스 작업을 통합하는 것을 목표로 합니다.
Surf 에 의해 제작됨 🏄
^1.0.0^0.1.0^3.0.0^1.17.2아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.
Made by Surf 🏄♂️🏄♂️🏄♂️
Build Status Coverage Status Pub Version Pub Likes Pub popularity Flutter Platform
Interface for working with analytic services. The library is supposed to unify work with various analytic services. The main actors are:
AnalyticStrategy.performAction method.performAction method to send analytic action.The easiest interaction with the library is as follows:
Determine the actions that ought to be recorded in the analytics service:
class MyAnalyticAction implements AnalyticAction {
final String key;
final String value;
MyAnalyticAction(this.key, this.value);
}
class ButtonPressedAction extends MyAnalyticAction {
ButtonPressedAction() : super("button_pressed", null);
}
class ScreenOpenedAction extends MyAnalyticAction {
ScreenOpenedAction({String param}) : super("screen_opened", param);
}
Implement analytic strategy:
class MyAnalyticStrategy
extends AnalyticStrategy<MyAnalyticAction> {
final SomeAnalyticsApi _analyticsApi;
SomeAnalyticsApi(this._analyticsApi);
@override
void performAction(MyAnalyticAction action) {
_analyticsApi.send(action.key, action.value);
}
}
Create an AnalyticService with your strategy:
final analyticService = AnalyticService.withStrategies({
MyAnalyticStrategy(analytics),
});
Usage:
analyticService.performAction(ButtonPressedAction());
Add analytics to your pubspec.yaml file:
dependencies:
analytics: $currentVersion$
At this moment, the current version of analytics is analytics version.
1.x.x
final analyticService = DefaultAnalyticService();
analyticService.addActionPerformer(
MyAnalyticActionPerformer(SomeAnalyticService()),
);
Starting from version 2.0.0, sending an event to a specific analytics service is implemented using strategies. The AnalyticService class stores these strategies. Implement analytics strategies using the AnalyticStrategy egy class.
final analyticService = AnalyticService.withStrategies({
MyAnalyticStrategy(analytics),
});
All notable changes to this project will be documented in this file.
To report your issues, submit directly in the Issues section.
If you would like to contribute to the package (e.g. by improving the documentation, fixing a bug or adding a cool new feature), please read our contribution guide first and send us your pull request.
Your PRs are always welcome.
Please feel free to ask any questions about this package. Join our community chat on Telegram. We speak English and Russian.