Analytics events
Nutrient React Native SDK provides a NotificationCenter
class, which can be used to subscribe to analytics events. These events allow you to easily collect usage data based on a user’s activity taking place in Nutrient React Native SDK components.
Registering for analytics events in the notification center
The example below shows how to register for an event listener to be notified when a document has loaded:
override componentDidMount() {
this.pdfRef.current?.getNotificationCenter().subscribe(NotificationCenter.AnalyticsEvent.ANALYTICS, (event: any) => {
console.log(event)
});
}
An event has a name and a dictionary of additional parameters.
Unregistering from analytics events in the notification center
The example below shows how to unregister from document loaded listener events:
override componentWillUnmount () {
this.pdfRef.current?.getNotificationCenter().unsubscribe(NotificationCenter.AnalyticsEvent.ANALYTICS);
}
For more details and sample code, see the EventListeners.tsx
example from the Catalog example project.