Audience: Client developers integrating Zixflow SDK (Android)
Purpose: Track push notification lifecycle events — delivery, open, and action clicks — so Zixflow can measure campaign performance accurately. See also: Push Notifications and the reference implementation in sdk-examples/android.
Why Push Tracking Matters
When Zixflow sends a push notification to a user’s device, it records that the notification was sent. But it cannot know on its own:- Did the notification actually arrive on the device?
- Did the user open it (tap the banner)?
- Did the user tap an action button (“Shop Now”, “Remind Me”)?
The Delivery Lifecycle at a Glance
The Push Payload
Zixflow injects two special fields into every push notification’s data payload. Your app uses these to associate the tracking event with the correct campaign delivery.
These appear inside
message.data (Flutter/Android) or userInfo (iOS native). The SDK’s trackMetric() method requires both to route the event correctly.
Example raw data payload received by the app:
Important:action_buttonsis a JSON string (not a nested object). Parse it withjson.decode()/JSONSerializationbefore use.
The Three Tracking Events
1. Delivery Confirmed
Event name (sent to Zixflow):Push Notification DeliveredWhen to fire: The moment the push data payload arrives on the device — inside your
onMessage / onMessageReceived / willPresent handler.SDK method:
Zixflow.instance.trackMetric(deliveryID:, deviceToken:, event: MetricEvent.delivered)What happens: Zixflow updates the campaign delivery record to
delivered. No profile event is stored.
Parameters:
false.
2. Notification Opened
Event name (sent to Zixflow):Push Notification OpenedWhen to fire: When the user taps the notification banner. Fire for both body taps and action button taps.
SDK method:
Zixflow.instance.trackMetric(deliveryID:, deviceToken:, event: MetricEvent.opened)What happens: Zixflow updates the campaign delivery record to
opened. No profile event is stored.
Parameters:
PendingIntent and handle in the Activity.
3. Action Button Clicked
Event name (sent to Zixflow):Push Notification Action ClickedWhen to fire: When the user taps a named action button (“Shop Now”, “Try It Free”, etc.). Always fire
trackMetric(opened) first, then fire this event.SDK method:
Zixflow.instance.track(name: "Push Notification Action Clicked", properties: {...})What happens: Zixflow records a
clicked delivery report and captures which button was tapped for campaign analytics.
This is a namedProperties:track()call — nottrackMetric(). There is noMetricEventenum for clicks.
notification_id into each action PendingIntent that you use with notify(). Reference: NotificationActionReceiver.kt.
Platform-Specific Integration
Token Registration
Track Delivery (Foreground — via onMessageReceived)
Track Open (Notification Tap)
Track Action Button Click
Action Buttons Format
Theaction_buttons field in the push payload is a JSON-encoded string containing an array of button objects. You must parse it before use.
Payload value (raw string):
- Maximum 2 buttons per notification
deeplinkmay be an empty string — handle gracefully, don’t navigate to a blank URL- Button index is 0-based
Parsing action_buttons
Building the Buttons on the Notification (Foreground Path)
NotificationActionReceiver is the BroadcastReceiver that fires the trackMetric(opened) + track("Push Notification Action Clicked") calls shown earlier — it reads back the extras you attached above.
Handling the Tap (End-to-End)
Important on Android (Kotlin): pressing an action button does not automatically dismiss the notification the way tapping the notification body does — see Sticky Notifications below.
Sticky Notifications
Field:sticky (boolean, sent in the data.* payload as the string "true" / "false")
“Sticky” means the notification survives passive dismissal — the user swiping it away, or hitting “Clear all”. This is Android-only.
This requires two separate Android notification flags, not one — and a third piece of manual cleanup for action buttons.
setAutoCancel(true)must always be on, regardless ofstickysetOngoing(true), driven bysticky, is what actually blocks swipe and “Clear all”- Action buttons need an explicit cancel call in your action handler
Android (Kotlin) — Native SDK / Manual Notification Builder
ZixflowPushNotificationHandler.kt, used automatically for background/foreground data-payload display) and in the sample app’s custom fallback handler — client apps using the standard Zixflow Android SDK get all of this for free, with zero additional code required, as long as the campaign payload includes sticky in its data block.
Deep Link Handling
Every Zixflow push notification may carry adeeplink_url at the top level and per-button deeplinks in action_buttons. Your app is responsible for routing these to the right in-app screen.
Priority order for navigation on tap:
- If an action button was tapped → use
action_buttons[index].deeplink - If body was tapped → use
deeplink_url - If neither is set → open app to default screen
ZixflowPushNotificationHandler.kt), deep link resolution is handled automatically — you don’t need to write any routing code. This lives in PushMessageProcessorImpl.handleNotificationDeepLink() and runs in this order:
- Host-app override — if you registered a
notificationCallbackinmoduleConfigand itsonNotificationClicked(context, payload)returns non-null, the SDK stops there and your callback owns navigation entirely. - Try your own app first — builds
Intent(ACTION_VIEW, uri).setPackage(context.packageName)and checksresolveActivity(). - Fall back externally — if no Activity in your app claims the URI,
queryIntentActivities()looks for any other installed app. - Default launcher fallback — if nothing matches at all, your app’s normal launcher Activity opens.
NotificationCallback.onNotificationClicked():
FirebaseMessagingService fallback), you resolve the URI yourself:
Decision Flowchart
Fallback Behaviour (No Zixflow-Delivery-ID)
If the push notification was sent by a non-Zixflow source,Zixflow-Delivery-ID and Zixflow-Delivery-Token will be absent from the payload.
In this case, skip trackMetric(). Push notification event names (Push Notification Delivered, Push Notification Opened, Push Notification Action Clicked) are reserved for Zixflow’s delivery pipeline — they are not stored as user profile events.
If you want to track a non-Zixflow push for your own analytics, use a custom event name instead.
Testing
EnableZixflowLogLevel.DEBUG. In the dashboard → Messaging → Push Notifications, check Delivered, Opened, and Clicked.