How to add service-worker to a separate folder?

The service worker is the key file to complete the subscription and ensures subscribers are collected on your domain. If you use the native opt-in, adding the service-worker.js file to the root or sub-directory is an important installation step. If you don’t have access to the root directory, but to a subfolder, you can still add the service-worker.js file and complete the installation. Here are the steps to follow –

  • Add the service-worker.js file to your subdirectory or a separate folder and copy the path to that folder.
  • Login to your PushEngage dashboard and navigate to Site Settings > Advanced Settings
  • Add the path for your service-worker.js file and save the changes.

That will be it once these changes are saved, your installation is complete.

Your registration of a service worker will be from PushEngage and through a sub-folder instead of the root directory.

If in case you run into any issues, please feel free to contact us by clicking here. Our support team will be able to help you.

Still stuck? How can we help?
Last updated on November 21st, 2022

Engage and Retain Visitors AfterThey’ve Left Your Website

Increase the value of every web visit with Push Notifications that are hard to miss.

  • Forever Free Plan
  • Easy Setup
  • 5 Star Support