Overview
Track three web push lifecycle events from your service worker (seesw.js):
- Push Notification Delivered —
pushevent - Push Notification Opened —
notificationclick(body or action) - Push Notification Action Clicked — when
event.actionis set (ACTION_0/ACTION_1)
Payload fields
Write key via SDK_CONFIG
Prefer receiving the write key from the WebPush plugin (not a hardcoded constant):1. Delivery Confirmed
Onpush: show the notification with actions from action_buttons, and track Delivered.
2–3. Opened and Action Clicked
Onnotificationclick:
- Always track Opened when delivery ID/token are present
- If
event.actionis set, parse rawaction_buttonsforname/deeplink(do not use the Notification API{ action, title }list for names) - Track Action Clicked
- Prefer button
deeplink, elsedeeplink_url - Focus an existing client +
postMessage({ type: 'NOTIFICATION_CLICK', ... }), orclients.openWindow
Zixflow-Delivery-ID, action_index, action_name. Recommended: Zixflow-Delivery-Token, action_deeplink. Optional: source: 'web_push'.
Helpers
Setting User ID
Afteranalytics.identify():
Decision flow
Non-Zixflow pushes
Skip reserved event names ifZixflow-Delivery-ID is missing.