Web push channel configuration
Here, you will configure the web push channel for your websites.
All web push notifications created in the ExpertSender CDP platform will be displayed in browsers on desktop and mobile devices, but not within the apps.
Requirements
Before you proceed with configuration, make sure that:
- The website you want to activate the web push channel for has is listed in the Web Tracking > Websites section.
- Web tracking channel has been configured for this website.
Web push channel configuration
- Go to Settings > Web push > Web push.
- Find the website you want to activate the web push channel for.
- Click the Configure icon to start the setup process.
The next steps will depend on whether a service worker file is already available on the server hosting your website.
A service worker file is a JavaSript file responsible for feeding the notifications to your visitors, even when they are not actively browsing your site.
Now, choose the appropriate configuration scenario.
The service worker file is already installed on my server
- In the Configure web push window, click I have the service worker file on my server tab.
- Copy the provided code.
- Log in to the server hosting your website.
- Find the service worker file using the file manager tool or a file browser. Common names include service-worker.js, or sw.js, usually located in one of the following directories:
- The root directory, e.g., [/service-worker.js]
- The ‘public’ directory, e.g., [/public/service-worker.js]
- Open the service worker file in edit mode. You can use the in-site editor or download the file to your computer and open it in any text editor, e.g., Notepad.
- Paste the code either at the beginning or end of the file. Avoid placing it randomly within the file, as it may not work properly.
- Save the changes.
- If you edited the file locally, upload it back to the server, replacing the old service worker file.
- Copy the file location, usually available as a URL:
- https://www.YourStore.com/service-worker.js – if located in the root directory.
- https://www. YourStore.com/public/service-worker.js – if located in the [public] directory.
- Return to Configure web push window in the platform.
- Paste the URL in the have the service worker file on my server tab.
- Click Verify the file status to check if the service worker file is accessible and working properly.
- Once the file has been verified, save the settings.
- After verification, the channel status will update to Active. You can check this in the table grid under Settings > Web push.
There is no service worker file on my server
- In the Configure web push window, click I don’t have the service worker file on the server tab.
- Click Download the service worker file. The file contains the code needed to enable web push notifications for the users.
- Log in to the server hosting your website.
- Using the file management tool, place the downloaded service worker file on your server. It is usually located in one of the following directories:
- The root directory, e.g., [/service-worker.js]
- The ‘public’ directory, e.g., [/public/service-worker.js]
- Open the service worker file in edit mode. You can use the in-site editor or download the file to your computer and open it in any text editor, e.g., Notepad.
- Paste the code either at the beginning or end of the file. Avoid placing it randomly within the file, as it may not work properly.
- Save the changes.
- If you edited the file locally, upload it back to the server replacing the old service worker file.
- Copy the file location, usually available as a URL:
- https://www.YourStore.com/service-worker.js – if located in the root directory.
- https://www. YourStore.com/public/service-worker.js – if located in the [public] directory.
- Return to Configure web push window in the platform.
- Paste the URL in I have the service worker file on my server tab.
- Click Verify the file status to check if the service worker file is accessible and working properly.
- Once the file has been verified, save the settings.
- After verification, the channel status will update to Active. You can check this in the table grid under Settings > Web push.
Now, the web push channel is ready to go!
What do I do when the web push configuration has failed?
Here are the most common causes of failed web push configuration and how to deal with them:
Cause | What should I do? |
The website has not been configured yet. | Add our tracking code to the website from which you want to send the web push notifications. |
There is no service worker file in the specified location. | Paste the URL path with the correct location of the file, or move the file to the location you specified in the ‘Verify the service worker file status’ section. Verify the file again. |
The code was added to the service worker file in the wrong place. | Past the code either at the beginning or at the end of the file. Verify the file again. |
Next steps
Once the web push channel is active, you need to collect visitors’ consent for sending web push notifications. You will do so by displaying the opt-in prompts in the visitors’ browsers.