If the Pushwoosh web push subscription prompt (sometimes called the 'consent widget' or 'opt-in prompt') isn't appearing on your website after you've added the integration code, there are a couple of common technical reasons:
-
The Service Worker file is inaccessible or misplaced:
- Pushwoosh requires a service worker file (
pushwoosh-service-worker.js
) to handle push notifications in the background. - By default, this file must be placed in the root directory of your website and be publicly accessible (e.g.,
https://your-website.com/pushwoosh-service-worker.js
). - Check: Try accessing this URL directly in your browser. If you get a 404 Not Found error, the file is missing or in the wrong location.
- Solution 1: Upload the
pushwoosh-service-worker.js
file (downloadable from the Pushwoosh control panel during platform configuration) to your website's root directory. - Solution 2 (If not in root): If you must place the file in a subdirectory (e.g.,
/js/
), you need to specify its location using theserviceWorkerUrl
parameter within the Pushwoosh initialization script:Pushwoosh.push(['init', { logLevel: 'error', // or 'debug' for more logs applicationCode: 'YOUR_APP_CODE', safariWebsitePushID: 'YOUR_SAFARI_WEBSITE_PUSH_ID', // If configured defaultNotificationTitle: 'Your Website Title', defaultNotificationImage: 'URL_TO_YOUR_DEFAULT_ICON', serviceWorkerUrl: '/js/pushwoosh-service-worker.js', // <-- Add this line with the correct path autoSubscribe: true, // Or false if you trigger subscription manually // ... other options }]);
- Pushwoosh requires a service worker file (
-
Incorrect Initialization Script Syntax:
- The Pushwoosh Web SDK relies on a specific JavaScript object (
Pushwoosh
) and method (.push()
) to initialize. - Sometimes, custom scripts or conflicts might interfere with this.
- Check: Ensure your initialization code strictly follows the documented format, specifically using
Pushwoosh.push([...])
. - Incorrect Example (Do NOT use):
// Incorrect - using a variable 'myVar' instead of 'Pushwoosh' var myVar = myVar || []; myVar.push(['init', { /* ... options ... */ }]);
- Correct Example:
// Correct - uses the global Pushwoosh object Pushwoosh.push(['init', { logLevel: 'error', applicationCode: 'YOUR_APP_CODE', safariWebsitePushID: 'YOUR_SAFARI_WEBSITE_PUSH_ID', defaultNotificationTitle: 'Your Website Title', defaultNotificationImage: 'URL_TO_YOUR_DEFAULT_ICON', autoSubscribe: true, // ... other options ... }]);
- The Pushwoosh Web SDK relies on a specific JavaScript object (
Troubleshooting Tip: Open your browser's Developer Console (usually by pressing F12) and check for any errors related to Pushwoosh
, pushwoosh-service-worker.js
, or general JavaScript errors when loading the page. This often provides specific clues.
Comments
0 comments
Article is closed for comments.