Skip to content

Commit 9a6e3c7

Browse files
Merge branch 'main' of github.com:GabrielRozendo/aptabase_flutter
2 parents 8e62824 + 29fef72 commit 9a6e3c7

2 files changed

Lines changed: 114 additions & 0 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,5 @@ A few important notes:
7676
## Preparing for Submission to Apple App Store
7777

7878
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.
79+
80+
For AI/LLM integration instructions, see [llms.txt](./llms.txt)

llms.txt

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# Aptabase — Flutter SDK
2+
3+
> Flutter SDK for Aptabase, an open-source, privacy-first analytics platform for Mobile, Desktop, and Web apps. GDPR-compliant, no cookies, no tracking of personal data.
4+
5+
Package: `aptabase_flutter`
6+
Install: `flutter pub add aptabase_flutter`
7+
Registry: https://pub.dev/packages/aptabase_flutter
8+
Repo: https://github.com/aptabase/aptabase_flutter
9+
10+
## Overview
11+
12+
Aptabase is an open-source, privacy-first analytics platform. This SDK integrates Aptabase into Flutter apps.
13+
14+
- Get your App Key from the Aptabase dashboard (Settings > Instructions)
15+
- App keys follow the format `A-EU-*` (European), `A-US-*` (US), or `A-SH-*` (self-hosted)
16+
- Only strings and numbers are allowed as custom property values
17+
- All tracking is non-blocking and runs in the background
18+
- No events are tracked automatically — you must call `trackEvent` manually
19+
20+
## Installation
21+
22+
```shell
23+
flutter pub add aptabase_flutter
24+
```
25+
26+
### Android Requirement
27+
28+
Add internet permission to `AndroidManifest.xml`:
29+
30+
```xml
31+
<uses-permission android:name="android.permission.INTERNET" />
32+
```
33+
34+
## Initialization
35+
36+
Initialize the SDK in your `main.dart` before `runApp`:
37+
38+
```dart
39+
import 'package:aptabase_flutter/aptabase_flutter.dart';
40+
41+
void main() async {
42+
WidgetsFlutterBinding.ensureInitialized();
43+
await Aptabase.init('<YOUR_APP_KEY>');
44+
45+
runApp(const MyApp());
46+
}
47+
```
48+
49+
**Important:** Your `main` function must be `async` and you must call `WidgetsFlutterBinding.ensureInitialized()` before `Aptabase.init`.
50+
51+
## Track Events
52+
53+
```dart
54+
import 'package:aptabase_flutter/aptabase_flutter.dart';
55+
56+
// Track a simple event
57+
Aptabase.instance.trackEvent('app_started');
58+
59+
// No need to await — runs in the background
60+
Aptabase.instance.trackEvent('button_clicked');
61+
```
62+
63+
## Track Events with Properties
64+
65+
```dart
66+
Aptabase.instance.trackEvent('purchase_completed', {
67+
'product': 'Premium Plan',
68+
'price': 9.99,
69+
'currency': 'USD',
70+
});
71+
72+
Aptabase.instance.trackEvent('level_completed', {
73+
'level': 5,
74+
'score': 1200,
75+
});
76+
```
77+
78+
Property values must be strings or numbers (int, double). No booleans, lists, or maps.
79+
80+
## Configuration
81+
82+
Pass `InitOptions` as the second argument to `Aptabase.init`:
83+
84+
```dart
85+
await Aptabase.init(
86+
'<YOUR_APP_KEY>',
87+
const InitOptions(
88+
host: 'https://your-self-hosted-instance.com', // only for self-hosted (A-SH-* keys)
89+
tickDuration: Duration(seconds: 30), // flush interval (default: 30s)
90+
batchLength: 25, // max events per batch (default/max: 25)
91+
printDebugMessages: false, // enable SDK debug logging
92+
),
93+
);
94+
```
95+
96+
- `host` — Required only for self-hosted instances (`A-SH-*` app keys)
97+
- `tickDuration` — How often queued events are flushed to the server (default: 30 seconds)
98+
- `batchLength` — Max events sent per flush (default and max: 25)
99+
- `printDebugMessages` — Enable SDK debug logging via `developer.log`
100+
101+
## Platform Notes
102+
103+
- Supported platforms: Android, iOS, macOS, Web, Linux, Windows
104+
- Sessions auto-rotate after 1 hour of inactivity
105+
- Events are queued locally and sent in batches for reliability
106+
- The SDK automatically collects OS name, OS version, locale, app version, and build number
107+
- Debug mode is auto-detected via `kDebugMode`
108+
- When submitting to the Apple App Store, see the [App Privacy guide](https://aptabase.com/docs/apple-app-privacy)
109+
110+
## Cross-Discovery
111+
112+
For all Aptabase SDKs and documentation, see: https://aptabase.com/llms.txt

0 commit comments

Comments
 (0)