Overview
Zixflow automatically tracks push notification delivery and engagement metrics to help you measure campaign performance. The SDK tracks three key lifecycle events:- Delivery Confirmed - When the notification arrives on the device
- Notification Opened - When the user taps the notification
- Action Button Clicked - When the user taps an action button
How Push Tracking Works
When Zixflow sends a push notification, it includes special tracking fields in the data payload:| Field | Purpose |
|---|---|
Zixflow-Delivery-ID | Unique ID for this delivery (links to campaign record) |
Zixflow-Delivery-Token | The APNs device token the notification was sent to |
Note: The SDK automatically handles most tracking when using the Notification Service Extension. This section covers advanced customization scenarios.
Tracking Events
1. Delivery Confirmed
When to track: In the Notification Service Extension when the push payload arrives SDK method:MessagingPush.shared.trackMetric(deliveryID:, event:, deviceToken:)
Implementation (NotificationService.swift):
Important: The SDK automatically tracks delivery when using the Notification Service Extension.
2. Notification Opened
When to track: When the user taps the notification SDK method: Handled automatically byMessagingPush.shared.didReceive(_:)
Implementation (AppDelegate.swift):
Note: The SDK automatically tracks opens when using the default delegate implementation.
3. Action Button Clicked
When to track: When the user taps a named action button SDK method: Automatically tracked inuserNotificationCenter(_:didReceive:withCompletionHandler:)
Action button properties:
| Property | Type | Required | Description |
|---|---|---|---|
Zixflow-Delivery-ID | string | ✅ | Links event to campaign delivery |
action_index | integer | ✅ | 0-based index of button tapped |
action_name | string | ✅ | Button label (e.g., “Shop Now”) |
Zixflow-Delivery-Token | string | Recommended | APNs device token |
action_deeplink | string | Recommended | Button’s URL |
Action Buttons Format
Theaction_buttons field in the push payload is a JSON-encoded string:
Raw payload value:
- Maximum 2-4 buttons per notification (iOS limitation)
deeplinkmay be empty — handle gracefully- Button index is 0-based (first button = index 0)
Complete Tracking Implementation
Here’s a complete AppDelegate with all tracking integrated:Tracking Decision Flowchart
App Groups for Delivery Tracking
To ensure delivery metrics are accurately tracked, configure App Groups: 1. Enable App Groups in Xcode:- Select your main app target
- Go to Signing & Capabilities
- Click + Capability → Add App Groups
-
Create a group:
group.com.yourcompany.yourapp.zixflow - Repeat for Notification Service Extension target
Fallback for Non-Zixflow Push
If a push notification doesn’t containZixflow-Delivery-ID (sent from another source), the SDK automatically skips tracking.
For custom analytics on non-Zixflow pushes, use a different event name:
Important: Push notification event names (Push Notification Delivered,Push Notification Opened,Push Notification Action Clicked) are reserved for Zixflow’s delivery pipeline.
Testing Push Tracking
Verify Tracking Events
Enable debug logging to see tracking events:[Zixflow] Push Notification Delivered tracked[Zixflow] Push Notification Opened tracked[Zixflow] Push Notification Action Clicked tracked
Check Campaign Analytics
- Log into Zixflow dashboard
- Navigate to Messaging → Push Notifications
- View campaign metrics:
- Sent - Total notifications sent
- Delivered - Arrived on device
- Opened - User tapped notification
- Clicked - User tapped action button