Analytics

The PSPDFKit Analytics API allows you to easily collect usage data based on a user’s activity taking place in PSPDFKit components.

The PSPDFKit Analytics API consists of:

  • An Analytics object containing all constants that are related to the Analytics API
  • An AnalyticsClient interface that you need to implement to capture analytics events

Integration

Enable Analytics

In order to collect analytics data, you need to implement the AnalyticsClient interface. This interface will be notified of all events emitted by PSPDFKit, and it is where you pass them to the analytics service of your choice.

Be aware that events are delivered on a background thread.

Create an instance of your AnalyticsClient when the app launches (preferably at the same time you’re initializing PSPDFKit) and register it with PSPDFKit.addAnalyticsClient():

1
2
val analyticsClient = MyAnalyticsClient()
PSPDFKit.addAnalyticsClient(analyticsClient)
1
2
AnalyticsClient analyticsClient = new MyAnalyticsClient();
PSPDFKit.addAnalyticsClient(analyticsClient);

Events

1
Every event has a name and a `Bundle` of additional parameters.

You can find the complete list of all PSPDFKit events and parameters in Analytics.Event.