You do not need to add any JavaScript to get "Delivered" data for web push. The Pushwoosh service worker reports delivery to Pushwoosh automatically: every time a push arrives, the SDK's push handler calls the messageDeliveryEvent API for that message, independently of any code on your page.
So if the "Delivered" metric is empty or low for your web pushes, the cause is the integration or the browser — not a missing event handler:
-
The Pushwoosh service worker is not the active one. If you ship your own service worker, it must import the Pushwoosh one and you must point the SDK at your file:
// inside your own service worker file importScripts('https://cdn.pushwoosh.com/webpush/v3/pushwoosh-service-worker.js' + self.location.search);Pushwoosh.push(['init', { applicationCode: 'XXXXX-XXXXX', serviceWorkerUrl: '/your-service-worker.js' }]); -
The SDK version is outdated. Update to the current
web-push-notificationsrelease. - The browser never woke the service worker — the browser was closed, or the OS/browser suppressed background delivery. Delivery confirmations arrive gradually, so the number keeps rising after a send.
The receive-push event does exist and is useful for your own logic (for example, in-page badges or logging), but it is not what populates the "Delivered" statistic:
Pushwoosh.push(['onLoad', function () {
Pushwoosh.addEventHandler('receive-push', function (payload) {
console.log('Triggered event: receive-push', payload.notification);
});
}]);
For more details, see the Pushwoosh Web SDK documentation.
Comments
0 comments
Please sign in to leave a comment.