Skip to content

Fondeadora/segment_flutter_sdk

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

segment_flutter_sdk

pub package

A Flutter plugin that allows sending analytics events to https://segment.com

Installation

Just add the dependency on your pubspec.yaml file

How to use it?

You need to initialize Segment tracker at application startup.

Future<void> main() async {
  final segmentTracker = await FlutterSegmentSdk.init(writeKey: "YOUR WRITE KEY HERE", logLevel: LogLevel.VERBOSE);
  runApp(MyApp(segmentTracker));
}

Note: There are other parameters available that allows you to customize how Segment SDK works. These are all the init method allowed parameters, being writeKey the only required one.

static Future<FlutterSegmentSdk> init({
    @required String writeKey,
    bool collectDeviceId,
    int flushQueueSize,
    String tag,
    LogLevel logLevel,
    bool trackApplicationLifecycleEvents,
    bool recordScreenViews,
    bool trackAttributionInformation,
    bool useFirebaseAnalytics,
  })

Track a screen

You can log screens and add custom properties to the screen log event.

Future<void> trackScreen({@required String name, Map<String, dynamic> properties})

Track event

You can also track events, api is similar as the one used for screens.

Future<void> trackEvent({@required String name, Map<String, dynamic> properties})

Identify a user

Segment allows you to identify customers, this SDK does so by using this method:

Future<void> identify({@required String userId})

Example

Checking example app will help you understanding how to initialise and use the SDK.

About

A Flutter plugin that allows sending analytics events to https://segment.com

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dart 41.9%
  • Kotlin 27.7%
  • Swift 24.3%
  • Ruby 4.0%
  • Objective-C 2.1%