To use a custom service worker file like /sw.js with the SDK, follow these steps.
Specify the file path in the initialization code:
Pushwoosh.push(['init', {
serviceWorkerUrl: '/sw.js'
}]);
Add the SDK import script to the /sw.js file. This line goes inside the service worker file itself:
importScripts('https://cdn.pushwoosh.com/webpush/v3/pushwoosh-service-worker.js' + self.location.search);
Use dynamic data for user identifiers. Replace placeholder values like userId with variables from your system. Static values cause the system to treat all visitors as a single user.
Comments
0 comments
Please sign in to leave a comment.