openpanel_flutter 0.2.0 copy "openpanel_flutter: ^0.2.0" to clipboard
openpanel_flutter: ^0.2.0 copied to clipboard

Openpanel is an open-source alternative to Mixpanel that combines the power of Mixpanel with the ease of Plausible. This package is not officially maintained by the Openpanel team.

Openpanel Flutter SDK #

Package on pub.dev

Non official Flutter SDK for Openpanel, the open source alternative to Mixpanel, GA & Plausible.

Getting started #

First, you need to create an account on Openpanel.

Install this package from pub.dev

$ flutter pub add openpanel_flutter

Usage #

Import the package:

import 'package:openpanel_flutter/openpanel_flutter.dart';

Then you need to initialize Openpanel before using it:

import 'package:openpanel_flutter/openpanel_flutter.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  await Openpanel.instance.initialize(
    options: OpenpanelOptions(
      clientId: <YOUR_CLIENT_ID>,
      clientSecret: <YOUR_CLIENT_SECRET>,
    )
  );

  runApp(MyApp());
}

Track navigation #

Add the OpenpanelObserverif you want to track navigation

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return OpenpanelObserver(
      child: MaterialApp(
        navigatorObservers: [
          OpenpanelObserver()
        ],
        ...
      ),
    );
  }
}

Track event #

To track an event, use:

Openpanel.instance.event('event_name', properties: {
  ...
})

Global properties #

You can set global properties that will be sent with every event. This is useful if you want to set a custom user id for example.

Openpanel.instance.setGlobalProperties({
  'user_id': '123',
  ...
});

Other options #

Customize the url

You can also customize the url of the openpanel server. This is useful if you have a custom domain or use a self-hosted instance of Openpanel.

Enable verbose logging

Openpanel.instance.initialize(
  options: OpenpanelOptions(
    clientId: <YOUR_CLIENT_ID>,
    clientSecret: <YOUR_CLIENT_SECRET>,
    verbose: true
  )
)

Disable events collection

You can disable events collection if you don't want to send events to Openpanel.

Openpanel.instance.setCollectionEnabled(false);

Data Tracking #

This plugin automatically tracks the following data:

  • App version
  • Build number
  • Platform
  • Device model
  • Os version
  • Manufacturer

Issues #

Contributing #

If you wish to contribute, please send a PR to the Github Repo

Credits #

1
likes
140
points
48
downloads

Publisher

verified publisherstevenosse.com

Weekly Downloads

Openpanel is an open-source alternative to Mixpanel that combines the power of Mixpanel with the ease of Plausible. This package is not officially maintained by the Openpanel team.

Repository (GitHub)

Topics

#analytics

Documentation

API reference

License

AGPL-3.0 (license)

Dependencies

device_info_plus, device_user_agent, dio, dio_smart_retry, equatable, flutter, logger, package_info_plus, referrer, shared_preferences, uuid

More

Packages that depend on openpanel_flutter