Skip to main content

Overview

Track three web push lifecycle events from your service worker (see sw.js):
  1. Push Notification Deliveredpush event
  2. Push Notification Openednotificationclick (body or action)
  3. Push Notification Action Clicked — when event.action is 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

On push: show the notification with actions from action_buttons, and track Delivered.

2–3. Opened and Action Clicked

On notificationclick:
  1. Always track Opened when delivery ID/token are present
  2. If event.action is set, parse raw action_buttons for name / deeplink (do not use the Notification API { action, title } list for names)
  3. Track Action Clicked
  4. Prefer button deeplink, else deeplink_url
  5. Focus an existing client + postMessage({ type: 'NOTIFICATION_CLICK', ... }), or clients.openWindow
Required action properties: Zixflow-Delivery-ID, action_index, action_name. Recommended: Zixflow-Delivery-Token, action_deeplink. Optional: source: 'web_push'.

Helpers


Setting User ID

After analytics.identify():

Decision flow

Non-Zixflow pushes

Skip reserved event names if Zixflow-Delivery-ID is missing.

Testing

DevTools → Application → Service Workers → Console. Dashboard → MessagingPush Notifications.