Skip to main content

Overview

With the Dart FCM + flutter_local_notifications integration (see Push Notifications and push_handlers.dart), you track engagement yourself:
  1. Delivered — call trackMetric(delivered) when the FCM data payload arrives (foreground and background), before showing the local notification; optionally also use an iOS NSE
  2. Opened — call trackMetric(..., MetricEvent.opened) on body taps and action presses
  3. Action Button Clicked — call track(name: 'Push Notification Action Clicked', ...)
The Flutter example tracks delivered, opened, and action clicked, then opens deeplinks via navigation.dart + url_launcher.

How Push Tracking Works

Example push payload:

Tracking Events

1. Delivery Confirmed

When: The push payload arrives on the device. SDK method: Zixflow.instance.trackMetric(..., event: MetricEvent.delivered) Optional manual delivery tracking (e.g. foreground Android):

2. Notification Opened

When: User taps the notification body (or an action button — track opened first, then the action event). SDK method: Zixflow.instance.trackMetric(..., event: MetricEvent.opened)
Also call _trackOpened from the local-notification tap handler (body and actions), using the JSON payload you stored when showing the notification.

3. Action Button Clicked

When: User taps ACTION_0 or ACTION_1. SDK method: Zixflow.instance.track(name: 'Push Notification Action Clicked', properties: {...})
On action press: track opened → track action clicked → cancel notification by id → open button deeplink if set, else deeplink_url. Required / recommended properties:
Shared helper used for FCM system opens and local-notification taps (navigation.dart):
Attach navigatorKey to MaterialApp and register named routes for in-app hosts. On Android 11+, declare <queries> for http/https if you open external links with url_launcher (see Push Notifications). Full tap hub (body vs action) from the example:

Action Buttons Format

  • Maximum 2 buttons (ACTION_0, ACTION_1)
  • Empty deeplink is allowed — fall back to deeplink_url or skip navigation

Background Isolate Taps

When the app was terminated and the user taps a local notification, the response may run in a background isolate. Re-initialize Zixflow before tracking:
Wire this as onDidReceiveBackgroundNotificationResponse when initializing FlutterLocalNotificationsPlugin.

Tracking Decision Flow


Fallback for Non-Zixflow Push

If the payload has no Zixflow-Delivery-ID, skip Zixflow push metrics. For your own analytics, use a different event name (do not use reserved push event names):
Reserved names include Push Notification Action Clicked and the metric pipeline behind trackMetric.

Testing Push Tracking

In the dashboard: Messaging → Push Notifications → check Delivered, Opened, and Clicked (action) for your campaign.