Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aptabase/aptabase_flutter
Flutter SDK for Aptabase: Open Source Privacy-First and Simple Analytics for Mobile, Desktop and Web Apps
https://github.com/aptabase/aptabase_flutter
analytics dart flutter flutter-plugin privacy
Last synced: 2 months ago
JSON representation
Flutter SDK for Aptabase: Open Source Privacy-First and Simple Analytics for Mobile, Desktop and Web Apps
- Host: GitHub
- URL: https://github.com/aptabase/aptabase_flutter
- Owner: aptabase
- License: mit
- Created: 2023-03-29T08:16:06.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-27T18:46:14.000Z (6 months ago)
- Last Synced: 2024-08-27T20:35:15.260Z (6 months ago)
- Topics: analytics, dart, flutter, flutter-plugin, privacy
- Language: C++
- Homepage: https://aptabase.com
- Size: 327 KB
- Stars: 16
- Watchers: 1
- Forks: 10
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
![Aptabase](https://aptabase.com/og.png)
# aptabase_flutter
[![pub package](https://img.shields.io/pub/v/aptabase_flutter.svg)](https://pub.dev/packages/aptabase_flutter)
[![pub points](https://img.shields.io/pub/points/aptabase_flutter?color=2E8B57&label=pub%20points)](https://pub.dev/packages/aptabase_flutter/score)Instrument your app with Aptabase, an Open Source, Privacy-First, and Simple Analytics for Mobile, Desktop, and Web Apps.
## Platform Support
| Android | iOS | MacOS | Web | Linux | Windows |
| :-----: | :-: | :---: | :-: | :---: | :-----: |
| ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |## Install
You can install the SDK by running the following command:
```shell
pub add aptabase_flutter
```## Android Requirements
If you're targeting Android, you'll need to add the following permissions to your `AndroidManifest.xml`:
```xml
```
## Usage
First, you need to get your `App Key` from Aptabase, you can find it in the `Instructions` menu on the left side menu.
On your `main.dart`, import `package:aptabase_flutter/aptabase_flutter.dart` and initialized the SDK.
```diff
void main() async {
+ WidgetsFlutterBinding.ensureInitialized();
+ await Aptabase.init(""); // 👈 this is where you enter your App KeyrunApp(const MyApp());
}
````Note:` You need to change your main function to be `async` and call `WidgetsFlutterBinding.ensureInitialized();` before initializing the SDK.
Afterward, you can start tracking events with `Aptabase.instance` anywhere in your Dart. Here's an example:
```dart
import 'package:aptabase_flutter/aptabase_flutter.dart';class _CounterState extends State {
int _counter = 0;// Tracking how many times the user has clicked the button, alongside the current counter value
void _incrementCounter() {
Aptabase.instance.trackEvent("increment", { "counter": _counter });
setState(() {
_counter++;
});
}
}
```A few important notes:
1. The SDK will automatically enhance the event with some useful information, like the OS, the app version, and other things.
2. You're in control of what gets sent to Aptabase. This SDK does not automatically track any events, you need to call `trackEvent` manually.
- Because of this, it's generally recommended to at least track an event at startup
3. You do not need to await for the `trackEvent` function, it'll run in the background.
3. Only strings and numbers values are allowed on custom properties## Preparing for Submission to Apple App Store
When submitting your app to the Apple App Store, you'll need to fill out the `App Privacy` form. You can find all the answers on our [How to fill out the Apple App Privacy when using Aptabase](https://aptabase.com/docs/apple-app-privacy) guide.