# Analytics

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

The Nutrient Analytics API consists of:

- A [`PDFAnalytics`](https://www.nutrient.io/api/ios/documentation/pspdfkitui/pdfanalytics) object that you can access through a shared Nutrient instance

- A [`PDFAnalyticsClient`](https://www.nutrient.io/api/ios/documentation/pspdfkitui/pdfanalyticsclient) protocol that you need to implement to capture analytics events

## Integration

The Nutrient Analytics API comes bundled with `PSPDFKitUI.xcframework`, so you don’t need to add any external packages. Just ensure you’re importing the `PSPDFKitUI` module in your file wherever you’re using this API.

### Enable analytics

The PSPDFKit Analytics API is **disabled** by default, so you first need to enable it to use it:

### SWIFT

```swift

PSPDFKit.SDK.shared.analytics.enabled = true

```

### OBJECTIVE-C

```objc

PSPDFKitGlobal.sharedInstance.analytics.enabled = YES;

```

Next, you need to implement the [`PDFAnalyticsClient`](https://www.nutrient.io/api/ios/documentation/pspdfkitui/pdfanalyticsclient) protocol. Your [`PDFAnalyticsClient`](https://www.nutrient.io/api/ios/documentation/pspdfkitui/pdfanalyticsclient) is a place to process Nutrient events and pass them to the analytics service of your choice.

Be aware that events are delivered on a **background queue**.

Create an instance of your [`PDFAnalyticsClient`](https://www.nutrient.io/api/ios/documentation/pspdfkitui/pdfanalyticsclient) when the app launches (preferably at the same time you’re configuring the Nutrient license) and register it with [`PDFAnalytics`](https://www.nutrient.io/api/ios/documentation/pspdfkitui/pdfanalytics):

### SWIFT

```swift

let analyticsClient = YourAnalyticsClient()
PSPDFKit.SDK.shared.analytics.add(analyticsClient)

```

### OBJECTIVE-C

```objc

id<PSPDFAnalyticsClient> analyticsClient = [[YourAnalyticsClient alloc] init];
[PSPDFKitGlobal.sharedInstance.analytics addAnalyticsClient:analyticsClient];

```

You can find a simple [`PDFAnalyticsClient`](https://www.nutrient.io/api/ios/documentation/pspdfkitui/pdfanalyticsclient) implementation in [`AnalyticsClientExample.swift`](https://github.com/PSPDFKit/pspdfkit-ios-catalog/blob/master/Catalog/Examples/AnalyticsClient/AnalyticsClientExample.swift) in the [Nutrient Catalog app](https://www.nutrient.io/../../getting-started/example-projects/#nutrient-catalog).
---

## Related pages

- [iOS PDF annotation events and notifications](/guides/ios/events-and-notifications/annotation.md)
- [Text selection events and notifications](/guides/ios/events-and-notifications/text-selection.md)
- [iOS PDF form updates and notifications guide](/guides/ios/events-and-notifications/forms.md)
- [Analytics events](/guides/ios/events-and-notifications/events.md)
- [Events and notifications](/guides/ios/events-and-notifications.md)

