mixpanel_analytics
Flutterアプリケーションで使用するためのMixpanel REST API用Dartラッパー。
- スター
- 19
- フォーク
- 29
- 最終プッシュ(UTC)
- 2023/08/18
- プロジェクト状態
- アーカイブ済み
元の README
以下は英語原文のスナップショットです。最新版は GitHub をご覧ください。
Mixpanel Analytics
A dart wrapper on the mixpanel REST API to be used in Flutter applications. As this is using the http REST API it works both with Android and iOS.
How to use it
There is an example app that demonstrates how to use the plugin,
You just need to instantiate the class and you'll be ready to send track or engage events.
Make sure to check mixpanel documentation for the REST API to know the options available.
MixpanelAnalytics(
token: 'XXXXXXXXX',
userId$: _user$.stream,
verbose: true,
ip: true,
shouldAnonymize: true,
shaFn: (value) => value,
onError: (e) => setState(() {
_error = e;
_success = null;
}),
);
There are two different constructors, the regular one which will send events on the fly and the batch mode which will group the requests (by type) and send them every X seconds (configurable).
MixpanelAnalytics.batch(
token: 'XXXXXXXXX',
userId$: _user$.stream,
uploadInterval: Duration(seconds: 30),
shouldAnonymize: true,
shaFn: (value) => value,
verbose: true,
onError: (e) => setState(() {
_error = e;
_success = null;
}),
);
Not supported yet
Check the documentation for more information on the features not yet supported https://developer.mixpanel.com/docs/http
Event Request Parameters
In addition to the data parameter, https://api.mixpanel.com/track supports a number of optional parameters. For the most part, these optional parameters are useful only in special situations.
| Parameters |
|---|
| ip |
| redirect |
| img |
| callback |
Update Request Parameters
In addition to the data parameter, https://api.mixpanel.com/engage supports a number of optional parameters. For the most part, these optional parameters are useful only in special situations.
| Parameters |
|---|
| redirect |
| callback |
Invalid requests
When sending batch requests, if one of them is invalid the whole batch operation will fail and the batch will be saved to retry the next iteration. This could become a problem as the whole batch could be stored and retried over and over. A strategy for this would be either to send individually the requests and ditch the only invalid one or just dith the whole lot (TBD).
Project Setup
This project is written in Flutter using the stable channel.
> flutter channel stable
> flutter upgrade
Install Dependencies
> flutter pub get
Build generated files (for Mockito)
> flutter pub run build_runner build --delete-conflicting-outputs
Note: During development this can be set to monitor for changes
> flutter pub run build_runner watch --delete-conflicting-outputs
Running tests
> flutter test --coverage
使用している依存関係
依存関係一覧 6 件
- flutter
{"sdk":"flutter"} - http
^0.13.0 - shared_preferences
^2.0.3 - flutter_test開発用
{"sdk":"flutter"} - build_runner開発用
^1.10.0 - mockito開発用
^5.0.0
プロジェクトに合うリポジトリを選ぶには?
用途で絞り込み、開発状況を比較し、採用前に元のリポジトリで要件を確認しましょう。
- 名前・作者・説明で検索し、技術トピックで絞り込みます。
- スター、フォーク、最近のプッシュを比較します。スターは関心の目安であり、品質の保証ではありません。
- 利用前に GitHub で README、ライセンス、Issues を確認します。
情報源と管理
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗