Skip to main content
Enable web push notifications in the browser to send timely messages to users.
Track your campaigns: Your service worker should track Delivered, Opened, and Action Clicked via CDP beacons. See Push Notification Tracking and sw.js in sdk-examples/javascript.

Prerequisites

  1. HTTPS (or http://localhost) — Web push requires a secure context
  2. Service Worker — default path /sw.js
  3. Write key — Your Zixflow write key
  4. User permission — Users must grant notification permission

Step 1: Install the package


Step 2: Add a service worker

Use a worker that:
  • Listens for SDK_CONFIG (write key + API base from the WebPush plugin)
  • Parses action_buttons into ACTION_0 / ACTION_1
  • Tracks Delivered / Opened / Action Clicked with keepalive: true
  • Posts NOTIFICATION_CLICK to focused clients (for onNotificationClick)
Reference implementation: sdk-examples/javascript/sw.js. Condensed pattern:
Do not use a dashboard field named data.actions — Zixflow sends action_buttons.

Step 3: Enable the Web Push plugin

The plugin posts SDK_CONFIG to the worker with your write key / API base.

Step 4: Request push permission


Step 5: Identify users


Web Push API reference


Best practices

  1. Request permission after explaining value
  2. Trigger subscribe from a user gesture
  3. Post SET_USER_ID after identify
  4. Use keepalive: true on track fetches in the SW
  5. Test on HTTPS / localhost

Troubleshooting

  • HTTPS (or localhost) required
  • Service worker registered at swUrl
  • Permission granted + subscribeToPush called
  • User identified; SW has write key via SDK_CONFIG