Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

mixpanel-flutter

mixpanel is a product analytics tool that enables you to capture data on how users interact with your digital product. mixpanel then lets you analyze this product data with simple, interactive reports that let you query and visualize the data with just a few clicks.

quick start guide

check out our official documentation for more in depth information on installing and using mixpanel on flutter.

installation

prerequisite

steps

  1. depend on it
    add this to your package’s pubspec.yaml file:
   dependencies:
      mixpanel_flutter: ^1.0.0 # set this to your desired version
  1. install it
    you can install packages from the command line:
   $ flutter pub get
  1. import it
    now in your dart code, you can use:
import 'package:mixpanel_flutter/mixpanel_flutter.dart';

integration

initialization

to start tracking with the sdk you must first initialize with your project token. to initialize the sdk, first add import 'package:mixpanel_flutter/mixpanel_flutter.dart'; and call mixpanel.init(token); with your project token as it’s argument.

import 'package:mixpanel_flutter/mixpanel_flutter.dart';
...
class _yourclassstate extends state<yourclass> {
  mixpanel mixpanel;

  @override
  void initstate() {
    super.initstate();
    initmixpanel();
  }

  future<void> initmixpanel() async {
    mixpanel = await mixpanel.init("your mixpanel token", optouttrackingdefault: false);
  }
...

once you’ve called this method once, you can access mixpanel throughout the rest of your application.

tracking

once you’ve initialized the sdk, mixpanel will automatically collect common mobile events. you can enable/disable automatic collection through your project settings.
with the mixpanel object created in the last step a call to track is all you need to send additional events to mixpanel.

// track with event-name
mixpanel.track('sent message');
// track with event-name and property
mixpanel.track('plan selected', properties: {'plan': 'premium'});

you’re done! you’ve successfully integrated the mixpanel flutter sdk into your app.


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

Comments are closed.