Analytics events and notifications
Nutrient Flutter SDK lets you listen to various events that occur when the end user interacts with the Nutrient SDK. These events can be used to track user behavior and to provide insights into how users are interacting with your application.
Enabling analytics events
Analytics events are triggered for every action a user performs in the Nutrient SDK. This can lead to a large number of events being triggered, and as a result, may have an impact on the performance of your application. To avoid this, the events are disabled by default. To enable analytics events, use the following code snippet:
Pspdfkit.enableAnalytics(true);
Usage
After enabling analytics events, start listening to the events by adding an event listener to the Pspdfkit
class:
Pspdfkit.analyticsEventsListener = (eventName, attributes) { if (kDebugMode) { print('Analytics event: $eventName with attributes: $attributes'); } };
The analyticsEventsListener
is a callback that’s called whenever an analytics event is triggered. The callback receives two parameters:
-
eventName
— The name of the event that was triggered. -
attributes
— A map of attributes associated with the event.
Supported events
For a full list of supported analytics events, refer to the following SDK documentation:
To have more control over the analytics events, use our native SDKs to implement custom analytics events. Refer to the Nutrient Flutter SDK customization guide for more information.