# Capture Push Metrics

 There's a new version available!

These pages cover version 2 of our SDK, but a newer version is available. In general, we suggest that you update to the latest version to take advantage of new features and fixes.

*   Are you new to our SDKs? [Check out the latest docs.](/integrations/sdk/react-native/getting-started)
*   Otherwise, [learn about updating to the latest version](/integrations/sdk/react-native/whats-new/)

## How it works[](#how-it-works)

Customer.io supports device-side metrics that help you determine the efficacy of your push notifications: `delivered` when a push notification is received by the app and `opened` when a push notification is clicked.

 Update to version 3 for Javascript functions

The React Native SDK version 3.0 introduced support for tracking push metrics using Javascript methods, eliminating the need for adding any native code. It’s recommended you [update to the latest version](/integrations/sdk/react-native/updates-and-troubleshooting/migrate-upgrade/) to take advantage of this feature.

If you already configured [push notifications](/integrations/sdk/react-native/push-notifications/push/) and your app does not use other push notification modules such as `expo-notifications` or `react-native-push-notification`, the SDK automatically tracks `opened` and `delivered` events for push notifications originating from Customer.io.

Otherwise, use one of the following methods to manually track push metrics:

*   [Record push metrics with native code](#metrics-userNotifications).

## iOS: Record push metrics with native code[](#metrics-userNotifications)

If you’re using Objective-C, the [example in our push setup process](/integrations/sdk/react-native/push/#register-push) already contains the code required to handle push metrics—substituting `AppDelegate` for your push notification class. If you use Swift, add the following code to track push notifications in your app.

```swift
extension AppDelegate: UNUserNotificationCenterDelegate {
   func userNotificationCenter(
      _ center: UNUserNotificationCenter,
      didReceive response: UNNotificationResponse,
      withCompletionHandler completionHandler: @escaping () -> Void
   ) {
      let handled = MessagingPush.shared.userNotificationCenter(center, didReceive: response,
                                                               withCompletionHandler: completionHandler)      

      // If the Customer.io SDK does not handle the push, you need to handle it and call the
      // completion handler. If the SDK handles it, it calls the completion handler for you.
      if !handled {
         completionHandler()
      }
   }
}
```

If `delivered` events are important to you, we recommend that you follow the setup instructions for [rich push notifications](/integrations/sdk/react-native/rich-push/), even if you do not plan on sending rich push notifications as rich push tracks `delivered` events more reliably.

## Disabling automatic push tracking[](#disabling-automatic-push-tracking)

Automatic push metric recording is enabled by default when you install the SDK. You can disable this behavior by passing a configuration option when you initialize the SDK. You cannot disable automatic push tracking (or change other configuration settings) after you initialize the SDK.

```javascript
const cioConfigOptions = new CustomerioConfig()
cioConfigOptions.autoTrackPushEvents = false

const env = new CustomerIOEnv()
env.siteId = Env.siteId
env.apiKey = Env.apiKey

CustomerIO.initialize(env, cioConfigOptions) 
```