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

outdated

A Flutter plugin for 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

Getting started #

Add this package to your project:

With the Flutter command:

 $ flutter pub add plausible_analytics

Or depend on it directly in your pubspec.yaml file (run an implicit flutter pub get):

dependencies:
    plausible_analytics: ^0.1.0

Then import it in your Dart code where you want to have the analytics:

import 'package:plausible_analytics/plausible_analytics.dart';

Usage #

For a simple pageview:

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

final plausible = Plausible(serverUrl, domain);
final event = plausible.event();

Or for a custom event (e.g. a conversion):

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

final plausible = Plausible(serverUrl, domain);
final event = plausible.event(
        name: 'conversion',
        page: 'homescreen',
        referrer: 'referrerPage');

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.

18
likes
0
pub points
77%
popularity

Publisher

verified publisherbostrot.com

A Flutter plugin for Plausible Analytics.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on plausible_analytics