amplitude_flutter 0.1.0 copy "amplitude_flutter: ^0.1.0" to clipboard
amplitude_flutter: ^0.1.0 copied to clipboard

outdated

Official Flutter plugin for tracking events and revenue to Amplitude.

amplitude_flutter #

A Flutter plugin for tracking events to Amplitude.

Usage #

To use this plugin, add amplitude_flutter as a dependency in your pubspec.yaml file.

Import package:amplitude_flutter/amplitude_flutter.dart, and instantiate AmplitudeFlutter with your API_KEY.

Example #

import 'package:amplitude_flutter/amplitude_flutter.dart';

Future<void> example() async {
  final AmplitudeFlutter analytics =  AmplitudeFlutter('API KEY');

  // log an event
  analytics.logEvent(name: 'Dart Click');

  // Log events with properties
  analytics.logEvent(name: 'Dart Click', properties: { 'key': 'value' });

  // identify a user
  final Identify identify = Identify()
    ..set('cohort', 'Test A')
    ..setOnce('completed_onboarding', 'true')
    ..add('login_count', 1)
    ..append('tags', 'new tag')
    ..unset('demo_user');

  analytics.identify(identify);

  // Amplitude Accounts [https://amplitude.zendesk.com/hc/en-us/articles/115001765532-Accounts] methods:
  // add a user to a group
  analytics.setGroup('orgId', 15);

  // change properties of a group
  analytics.groupIdentify('orgId', 15, Identify()..set('account_manager', 456));

  // emit an event associated with a group
  analytics.logEvent('Demo Released', properties: { 'groups': { 'orgId': 15 } });

  // Log revenue
  final Revenue revenue = Revenue()
    ..setPrice(23.23)
    ..setQuantity(3)
    ..setProductId('widget1')

  analytics.logRevenue(revenue);
}

Getting Started #

For help getting started with Flutter, view our online documentation.

For help on editing plugin code, view the documentation.

90
likes
0
pub points
97%
popularity

Publisher

unverified uploader

Official Flutter plugin for tracking events and revenue to Amplitude.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

crypto, device_info, flutter, http, sqflite, uuid

More

Packages that depend on amplitude_flutter