plausible_analytics 0.3.0 copy "plausible_analytics: ^0.3.0" to clipboard
plausible_analytics: ^0.3.0 copied to clipboard

A Flutter plugin for Plausible Analytics. This uses the events API to send clickevents and goals to Plausible Analytics.

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 width

Following information is generated by the Plausible server:

  • Country
  • Current time

Plausible setup #

Add a new site in plausible with your app name:

Plausible Screenshot

Android #

Using plausible on Android in release mode required internet permission in manifest

<uses-permission android:name="android.permission.INTERNET" />

Basic Usage #

For a simple pageview:

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):

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):

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 which this package uses.

Usage with Navigator #

const String serverUrl = "https://plausible.io";
const String domain = "yourapp.com";

final plausible = Plausible(serverUrl, domain);

MaterialApp(
  navigatorObservers: [
    PlausibleNavigatorObserver(plausible),
  ],
  home: HomeScreen(),
);
18
likes
160
points
1.16k
downloads

Publisher

verified publisherbostrot.com

Weekly Downloads

A Flutter plugin for Plausible Analytics. This uses the events API to send clickevents and goals to Plausible Analytics.

Repository (GitHub)
View/report issues

Documentation

API reference

License

GPL-3.0 (license)

Dependencies

flutter, universal_io

More

Packages that depend on plausible_analytics