iZooto Service Worker

Common questions about the iZooto Service Worker used for Web Push.

What are Service Workers?

Web Push Notifications for most browsers (not Safari) require Service Worker file(s) to be available on your domain in order to subscribe and receive web push notifications.

These files generally get downloaded upon accepting to receive push notifications.


How do I Integrate iZooto's Service Worker File?

❗️

Skip if using our WordPress or Shopify Plugins

The iZooto Service Worker file gets added automatically through our plugins, and you should not add these files to your website manually.

1. Download the service-worker.js file

You can download the zip file from the iZooto dashboard under Settings > Setup > Install > Step 2. The downloaded zip contains the iZooto Service Worker file.

2. Upload the .js file to your server

You can place the service-worker.js file on your website's root directory or in a sub-directory path you will never link users to.

If you place the file in a sub-directory path, they will not conflict with any other Service Workers you have now or may add in the future.

  • Example sub-directory path: https://yoursite.com/izooto/webpush/

The sub-directory path needs to be defined on the iZooto panel under Settings > Setup > Install > Step 2 > Don't have access to root directory.

These files should be put in a permanent location that will never change! Once a ServiceWorker is registered with the browser, it is very difficult to change.

3. How to Upload Files

If you are unsure how to upload files to your server, some common options are as given below:

Option

Details

FTP

  • Use an FTP Server like FileZilla to upload the files to the root directory of your website.
  • Here is a step-by-step guide.

Control Panel

  • Use your hosting provider's control panel like cPanel to upload files.

Contact your Hosting Provider

  • Most hosting providers will be more than happy to assist you in uploading files to your website.
  • Just send them the zip file and ask them to unzip it in your website's root directory.

What if I can't upload .js files to my domain at all?

As long as you can add JavaScript to your site, you can always add the website as HTTP to the iZooto panel. We will provide you a sub-domain to subscribe users under without needing service workers.

4. Service Worker Configuration

Almost done! You now need to tell iZooto where to find this Service Worker file.

If you placed them in your site's root directory, then you are done if they are accessible publicly at:

  • https://yoursite.com/service-worker.js
  • https://yoursite.com/izooto.html

If you placed them in a sub-directory path, ensure you define the sub-directory path on the iZooto panel under Settings > Setup > Install > Step 2 > Don't have access to root directory.

📘

Multiple Service Workers on Root Directory

It is recommended that the Service Worker is always hosted on the root directory of the website. If you already have an existing service worker on the root directory, you can append the iZooto's ServiceWorker's contents to the existing service worker file and communicate the same to the iZooto Solutions team.

Additionally, if there is a need to change the name of the ServiceWorker file, the same should be communicated to iZooto Solutions team immediately so that the appropriate changes can be done to the backend configuration.

👍

Done!!

You have successfully configured iZooto's Service Worker to push web notifications.


Did this page help you?