enablePushEngagementTracking method

Future<void> enablePushEngagementTracking({
  1. dynamic onNotificationTapped(
    1. NotificationResponse
    )?,
})

Enable push notification engagement tracking

onNotificationTapped optional callback that will be invoked when user taps a notification. The callback receives the notification data payload as a Map<String, dynamic>.

Navigation Behavior:

  • If onNotificationTapped is provided: SDK skips automatic navigation, you handle it in the callback
  • If onNotificationTapped is null: SDK handles navigation automatically based on payload

Engagement tracking always happens regardless of callback presence.

Implementation

Future<void> enablePushEngagementTracking({
  Function(NotificationResponse)? onNotificationTapped,
}) async {
  await EngagementTrackingService.instance.initialize(
    onNotificationTapped: onNotificationTapped,
  );
}