Analytics events and notifications
Nutrient Flutter SDK can emit analytics events when users interact with the viewer. Use these events to track behavior and understand how people use your app.
Analytics events aren’t exposed on the bindings API (package:nutrient_flutter/bindings.dart) yet. The Nutrient.enableAnalytics/Nutrient.analyticsEventsListener API below is part of the legacy method-channel surface. For bindings-based apps, reach the native analytics APIs through platform adapters.
Enable analytics events
Nutrient Flutter SDK sends analytics events for each user action. This can produce many events and affect app performance, so the SDK disables analytics events by default.
Use the following code to enable analytics events:
Nutrient.enableAnalytics(true);Listen for analytics events
After you enable analytics events, add an event listener to the Nutrient class:
Nutrient.analyticsEventsListener = (eventName, attributes) { if (kDebugMode) { print('Analytics event: $eventName with attributes: $attributes'); } };The analyticsEventsListener callback runs whenever the SDK sends an analytics event. The callback receives two parameters:
eventName— The name of the event.attributes— A map of attributes associated with the event.
Supported events
Refer to the following SDK documentation for the full list of supported analytics events:
To control analytics events in more detail, use our native SDKs to implement custom analytics events. Refer to the Nutrient Flutter SDK customization guide for more information.