https://github.com/bostrot/flutter_plausible_analytics
Plausible Analytics for Flutter as a Dart package.
https://github.com/bostrot/flutter_plausible_analytics
flutter package plausible plausible-analytics
Last synced: 4 months ago
JSON representation
Plausible Analytics for Flutter as a Dart package.
- Host: GitHub
- URL: https://github.com/bostrot/flutter_plausible_analytics
- Owner: bostrot
- License: gpl-3.0
- Created: 2021-11-06T15:11:44.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-02-12T13:26:08.000Z (over 1 year ago)
- Last Synced: 2025-04-07T22:35:45.941Z (6 months ago)
- Topics: flutter, package, plausible, plausible-analytics
- Language: Dart
- Homepage:
- Size: 61.5 KB
- Stars: 12
- Watchers: 2
- Forks: 7
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
## Features
Send pageviews and custom events to Plausible Analytics so you have privacy friendly
analytics.This will log following information:
* A pageview or event
* Current page in the app (e.g. Homescreen)
* Operating System
* OS Version
* Referrer
* Screen widthFollowing information is generated by the Plausible server:
* Country
* Current time## Plausible setup
Add a new site in plausible with your app name:

### Android
Using plausible on Android in release mode required internet permission in manifest``````
## Basic Usage
For a simple pageview:
```dart
const String serverUrl = "https://plausible.io";
const String domain = "yourapp.com";final plausible = Plausible(serverUrl, domain);
final event = plausible.event(); // click event
```Or for a custom event (e.g. a conversion):
```dart
const String serverUrl = "https://plausible.io";
const String domain = "yourapp.com";final plausible = Plausible(serverUrl, domain);
final event = plausible.event(
name: 'conversion',
page: 'homescreen',
referrer: 'referrerPage',
props: {
'app_version': 'v1.0.0',
'app_platform': 'windows',
'app_locale': 'de-DE',
'app_theme': 'darkmode',
});
```Disable analytics (might be useful if a user opts out):
```dart
plausible.enabled = false;
```You can also use a custom user agent but that is not recommended as
the default one already puts in the current Operation System & Version.Also check [Plausible API docs Events API](https://plausible.io/docs/events-api) which this package uses.
## Usage with Navigator
```dart
const String serverUrl = "https://plausible.io";
const String domain = "yourapp.com";final plausible = Plausible(serverUrl, domain);
MaterialApp(
navigatorObservers: [
PlausibleNavigatorObserver(plausible),
],
home: HomeScreen(),
);
```