Analytics

Sessions & push opens

Measure session length and per-notification open rates with the native-notify analytics flags.

Sessions

Set analytics: { sessions: true }. registerNNPushToken does the rest: a session starts when the app becomes active and ends when it leaves the active state. Durations are clamped to 24 hours, and the server dedupes by session id. Reporting is best-effort and skipped where AppState is missing. The Growth & Engagement card shows sessions per day, average length and the change vs. the previous period.

Without registerNNPushToken, set your ids with NativeNotify.init(), since the reports read them there, and call the hook:

import { NativeNotify, useNativeNotifySessionTracking } from "native-notify";

NativeNotify.init({ appId: yourAppId, appToken: "yourAppToken", analytics: { sessions: true } });

export default function App() {
  useNativeNotifySessionTracking();
  // ...
}

Push opens

Set analytics: { opens: true }. When a user taps a push, the SDK reports it and the dashboard attributes the open to that notification. The Push Notification Delivery & Opens card shows delivered, opened (total taps), unique opens and open rate per notification, with a trend over the most recent 50 sends. Best Send Times shows opens by weekday × hour (UTC).

  • Every push API send and every Classic mass and individual push carries nn_notification_id and nn_source in its payload, on every transport. Your other pushData keys are untouched. The ids are left out if they would push the message past 4 KiB, and the send never fails because of it.
  • Classic group and topic pushes carry no id, so their taps aren't counted.
  • The server adds the id with or without the flag. The SDK reads it on tap, including the tap that launches a cold app, and reports it once, only while opens is on.
  • "Opened" is client-reported and best-effort: it counts at the tap, only in apps running the SDK with the flag on. Delivered comes from Expo's delivery receipts. For push API sends it means the push service accepted the message.
  • To handle taps yourself, call reportNotificationOpen(pushData) with the notification's data object. It reads the same id, collapses duplicates and does nothing unless opens is on.

The Send Failures card needs no flag.